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掉相关进程即可

你可能感兴趣的:(Emqtt)