AWS 上的 Ejabberd MQTT 启动失败:未定义退出,原因为 {'EXIT',{undef,[{mod_mqtt,socket_type,[],[]}
Ejabberd MQTT on AWS fails to launch: undefined exit with reason {'EXIT',{undef,[{mod_mqtt,socket_type,[],[]}
我遵循教程https://docs.ejabberd.im/admin/guide/mqtt/#enabling-mqtt-service-in-ejabberd。
这是我的配置,和教程一样。我还在 AWS 安全组上打开了端口 1883、8883。
hosts:
- "localhost"
listen:
-
port: 1883
module: mod_mqtt
backlog: 1000
-
port: 5280
module: ejabberd_http
request_handlers:
...
"/mqtt": mod_mqtt
-
port: 8883
module: mod_mqtt
backlog: 1000
tls: true
# adapt the path to your own certfile
certfiles:
- "/var/snap/ejabberd/tls/mqtt.pem"
modules:
...
mod_mqtt: {}
但是 ejabberd 无法启动,抛出以下错误:
2020-03-29 21:30:59.416 [error] <0.299.0> Supervisor ejabberd_listener had child
{1883,{0,0,0,0},tcp} started with ejabberd_listener:start({1883,{0,0,0,0},tcp},
mod_mqtt, [{backlog,1000}]) at undefined exit with reason {'EXIT',{undef,
[{mod_mqtt,socket_type,[],[]},{ejabberd_listener,start,3,[{file,
"src/ejabberd_listener.erl"},{line,86}]},{supervisor,do_start_child,2,[{file,
"supervisor.erl"},{line,358}]},{supervisor,start_children,3,[{file,
"supervisor.erl"},{line,341}]},{supervisor,init_children,2,[{file,
"supervisor.erl"},{line,307}]},{gen_server,init_it,6,[{file,"gen_server.erl"},
{line,328}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,240}]}]}}
in context start_error
和
2020-03-29 21:29:31.371 [error] <0.38.0>@ejabberd_config:validate_opts:1022
unknown option 'certfiles' will be likely ignored
{undef, [{mod_mqtt,socket_type,[],[]},
这意味着 erlang 无法找到文件 mod_mqtt.beam
... 或者可能找到了文件,但它没有包含函数 socket_type/0 的定义。在 ejabberd 19.02 中添加了具有该功能的模块:https://github.com/processone/ejabberd/commit/a3df791373c30ccc79a6082f4c910a378d726cdc
所以,也许您安装了旧版本,或者安装错误并且缺少该模块。
unknown option 'certfiles' will be likely ignored
选项 certfiles
是在 ejabberd 17.11 中添加的,所以我不明白最近的 ejabberd 怎么会抱怨它是未知的:
https://github.com/processone/ejabberd/commit/35b7203e01aefbdfe4ea7804ebe20a8667466628
我遵循教程https://docs.ejabberd.im/admin/guide/mqtt/#enabling-mqtt-service-in-ejabberd。
这是我的配置,和教程一样。我还在 AWS 安全组上打开了端口 1883、8883。
hosts:
- "localhost"
listen:
-
port: 1883
module: mod_mqtt
backlog: 1000
-
port: 5280
module: ejabberd_http
request_handlers:
...
"/mqtt": mod_mqtt
-
port: 8883
module: mod_mqtt
backlog: 1000
tls: true
# adapt the path to your own certfile
certfiles:
- "/var/snap/ejabberd/tls/mqtt.pem"
modules:
...
mod_mqtt: {}
但是 ejabberd 无法启动,抛出以下错误:
2020-03-29 21:30:59.416 [error] <0.299.0> Supervisor ejabberd_listener had child
{1883,{0,0,0,0},tcp} started with ejabberd_listener:start({1883,{0,0,0,0},tcp},
mod_mqtt, [{backlog,1000}]) at undefined exit with reason {'EXIT',{undef,
[{mod_mqtt,socket_type,[],[]},{ejabberd_listener,start,3,[{file,
"src/ejabberd_listener.erl"},{line,86}]},{supervisor,do_start_child,2,[{file,
"supervisor.erl"},{line,358}]},{supervisor,start_children,3,[{file,
"supervisor.erl"},{line,341}]},{supervisor,init_children,2,[{file,
"supervisor.erl"},{line,307}]},{gen_server,init_it,6,[{file,"gen_server.erl"},
{line,328}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,240}]}]}}
in context start_error
和
2020-03-29 21:29:31.371 [error] <0.38.0>@ejabberd_config:validate_opts:1022
unknown option 'certfiles' will be likely ignored
{undef, [{mod_mqtt,socket_type,[],[]},
这意味着 erlang 无法找到文件 mod_mqtt.beam
... 或者可能找到了文件,但它没有包含函数 socket_type/0 的定义。在 ejabberd 19.02 中添加了具有该功能的模块:https://github.com/processone/ejabberd/commit/a3df791373c30ccc79a6082f4c910a378d726cdc
所以,也许您安装了旧版本,或者安装错误并且缺少该模块。
unknown option 'certfiles' will be likely ignored
选项 certfiles
是在 ejabberd 17.11 中添加的,所以我不明白最近的 ejabberd 怎么会抱怨它是未知的:
https://github.com/processone/ejabberd/commit/35b7203e01aefbdfe4ea7804ebe20a8667466628