在一台服务器上来回操作重启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/emq@127.0.0.1/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/emq@127.0.0.1/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/emq@127.0.0.1/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/emq@127.0.0.1/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
1
2
3
4
5
6
最后卸载已经安装的EMQ包,例如下:
卸载EMQ
查看安装包:
[root@home configs]# rpm -qa | grep emqttd
emqttd-2.3-1.el6.x86_64
1
2
卸载安装包:
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 'emqttd@127.0.0.1' is started
emqttd 2.0 is running
1
2
3
停止服务器:
./bin/emqttd stop
有时候不好使用,直接杀死进程比较有效
重复快速关闭重启服务提示,主要是在与其它EMQ集群之后出现
Protocol 'inet_tcp': register/listen error: eaddrinuse
1
原因是端口一直在被占用
sudo netstat -apn | grep 1883
1
kill掉相关进程即可