EMQX功能强大,但是帮助信息或者可用资料的确有限,遇到个问题,比较难找到处理的头绪,今天,我要记录的是,使用中出现EMQX宕机,但是呢,启动也启动不了。 今天记录的内容,就以操作EMQX 3.2.3的版本来说吧。

你可能看到有下面的信息:

[root@tkwh-kfcs-app3 emqx]# emqx start
emqx v3.2.3 is started successfully!

但是呢,你查看状态,又会看到下面的内容:

[root@tkwh-kfcs-app3 emqx]# emqx_ctl status
Node '[email protected]' not responding to pings

这个是什么情况呢?其实就是EMQX启动异常了,然后又shutdown了,看看日志,在/var/log/emqx下面的 erlang.log.1 文件里面可以找到些许的信息。

       =====
===== LOGGING STARTED Fri Oct :: CST
=====
Exec: /usr/lib/emqx/erts-10.3/bin/erlexec -boot /usr/lib/emqx/releases/v3.2.3/emqx -mode embedded -boot_var ERTS_LIB_DIR /usr/lib/emqx/erts-10.3/../lib -mnesia dir "/var/lib/emqx/mnesia/[email protected]" -config /var/lib/emqx/c
onfigs/app.2019.10.25.10.55.38.config -args_file /var/lib/emqx/configs/vm.2019.10.25.10.55.38.args -vm_args /var/lib/emqx/configs/vm.2019.10.25.10.55.38.args -- console^M
Root: /usr/lib/emqx^M
/usr/lib/emqx^M
Erlang/OTP [erts-10.3] [source] [-bit] [smp::] [ds:::] [async-threads:] [hipe]^M
^M
-- ::43.487 [info] event=server_setup_successfully driver=tcp socket="#Port<0.8>"^M
-- ::43.488 [info] event=start^M
Starting emqx on node [email protected]^M
-- ::43.562 [info] Ekka(Membership): Node [email protected] up^M
-- ::43.580 [notice] application: emqx^M
exited: {bad_return,^M
{{emqx_app,start,[normal,[]]},^M
{'EXIT',^M
{{badmatch,^M
{error,^M
{shutdown,^M
{failed_to_start_child,emqx_router_sup,^M
{shutdown,^M
{failed_to_start_child,helper,^M
{{badmatch,{error,{not_active_local,emqx_routing_node}}},^M
[{emqx_router_helper,init,,^M
[{file,^M
"/emqx_temp/emqx_rel/_checkouts/emqx/src/emqx_router_helper.erl"},^M
{line,}]},^M
{gen_server,init_it,,^M
[{file,"gen_server.erl"},{line,}]},^M
{gen_server,init_it,,^M
[{file,"gen_server.erl"},{line,}]},^M
{proc_lib,init_p_do_apply,,^M
[{file,"proc_lib.erl"},{line,}]}]}}}}}}},^M
[{emqx_app,start,,^M
[{file,^M
"/emqx_temp/emqx_rel/_checkouts/emqx/src/emqx_app.erl"},^M
{line,}]},^M
{application_master,start_it_old,,^M
[{file,"application_master.erl"},{line,}]}]}}}}^M
type: permanent^M
[os_mon] memory supervisor port (memsup): Erlang has closed^M
[os_mon] cpu supervisor port (cpu_sup): Erlang has closed^M
{"Kernel pid terminated",application_controller,"{application_start_failure,emqx,{bad_return,{{emqx_app,start,[normal,[]]},{'EXIT',{{badmatch,{error,{shutdown,{failed_to_start_child,emqx_router_sup,{shutdown,{failed_to_start_chi
ld,helper,{{badmatch,{error,{not_active_local,emqx_routing_node}}},[{emqx_router_helper,init,,[{file,\"/emqx_temp/emqx_rel/_checkouts/emqx/src/emqx_router_helper.erl\"},{line,95}]},{gen_server,init_it,2,[{file,\"gen_server.erl\
"},{line,374}]},{gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,342}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,249}]}]}}}}}}},[{emqx_app,start,2,[{file,\"/emqx_temp/emqx_rel/_checkouts/emqx/src/emqx_app
.erl\"},{line,32}]},{application_master,start_it_old,4,[{file,\"application_master.erl\"},{line,277}]}]}}}}}"}^M^M
Kernel pid terminated (application_controller) ({application_start_failure,emqx,{bad_return,{{emqx_app,start,[normal,[]]},{'EXIT',{{badmatch,{error,{shutdown,{failed_to_start_child,emqx_router_sup,{sh^M^M
^M^M
Crash dump is being written to: /var/log/emqx/crash.dump...done^M^M

什么意思呢?其实就是在安装路径的/var/lib/emqx下面有些异常数据,导致emqx启动时做数据同步时,出现错误,最后就宕机了。解决办法,就是将/var/lib/emqx下的数据清除掉,然后重新安装,当然,相关的配置,需要再次配置一下。

最后,再次将emqx安装一遍,就没有什么问题了。

 

05-11 22:10