EMQ服務器問題處理及分析

問題描述

在一臺服務器上來回操作重啓EMQ,在進行集羣和退出集羣操作,日誌報以下錯誤。
EMQ使用rpm命令安裝,一直無法定位到相關問題。

2018-04-27 10:13:02.032 [error] <0.1274.0> Supervisor emqttd_sup had child emqttd_broker started with emqttd_broker:start_link() at <0.1325.0> exit with reason bad argument in call to ets:lookup(mqtt_route, <<"$SYS/brokers/[email protected]/uptime">>) in emqttd_router:'-match/1-lc$^0/1-0-'/1 line 94 in context child_terminated
2018-04-27 10:13:02.032 [error] <0.1274.0> Supervisor emqttd_sup had child emqttd_broker started with emqttd_broker:start_link() at <0.1325.0> exit with reason reached_max_restart_intensity in context shutdown
2018-04-27 10:14:10.203 [error] <0.1325.0> gen_server emqttd_broker terminated with reason: bad argument in call to ets:lookup(mqtt_route, <<"$SYS/brokers/[email protected]/uptime">>) in emqttd_router:'-match/1-lc$^0/1-0-'/1 line 94
2018-04-27 10:14:10.203 [error] <0.1325.0> CRASH REPORT Process emqttd_broker with 0 neighbours crashed with reason: bad argument in call to ets:lookup(mqtt_route, <<"$SYS/brokers/[email protected]/uptime">>) in emqttd_router:'-match/1-lc$^0/1-0-'/1 line 94
2018-04-27 10:14:10.204 [error] <0.1274.0> Supervisor emqttd_sup had child emqttd_broker started with emqttd_broker:start_link() at <0.1325.0> exit with reason bad argument in call to ets:lookup(mqtt_route, <<"$SYS/brokers/[email protected]/uptime">>) in emqttd_router:'-match/1-lc$^0/1-0-'/1 line 94 in context child_terminated
2018-04-27 10:14:10.204 [error] <0.1274.0> Supervisor emqttd_sup had child emqttd_broker started with emqttd_broker:start_link() at <0.1325.0> exit with reason reached_max_restart_intensity in context shutdown

最後卸載已經安裝的EMQ包,例如下:

卸載EMQ

查看安裝包:

[root@home configs]# rpm -qa | grep emqttd
emqttd-2.3-1.el6.x86_64

卸載安裝包:
rpm -e emqttd-2.3-1.el6.x86_64

安裝指定包:
rpm -ivh emqttd-centos6.8-v2.3-1.el7.centos.x86_64.rpm
更換了好幾個不同版本都一直報同樣的錯誤,只能放棄rpm安裝方式。

通用包安裝

最後使用通用包安裝方法
控制檯調試模式啓動,檢查 EMQ 是否可正常啓動:
/usr/local/emqttd/bin/emqttd console

CTRL+c 關閉控制檯。守護進程模式啓動:
./bin/emqttd start
啓動錯誤日誌將輸出在 log/ 目錄。

EMQ消息服務器進程狀態查詢:
./bin/emqttd_ctl status

正常運行狀態,查詢命令返回:

$ ./bin/emqttd_ctl status
Node '[email protected]' is started
emqttd 2.0 is running

停止服務器:
./bin/emqttd stop
有時候不好使用,直接殺死進程比較有效

重複快速關閉重啓服務提示,主要是在與其它EMQ集羣之後出現

Protocol 'inet_tcp': register/listen error: eaddrinuse

原因是端口一直在被佔用

sudo netstat -apn | grep  1883

kill掉相關進程即可

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章