将rabbitmq web mqtt插件绑定到loopback接口

时间:2018-03-21 00:05:52

标签: rabbitmq

如何将rabbitmq web mqtt插件仅绑定到loopback接口?

我正在尝试使用配置文件/etc/rabbitmq/rabbitmq.conf

listeners.tcp.1 = 127.0.0.1:5672
management.listener.ip = 127.0.0.1
management.listener.port = 15672
mqtt.listeners.tcp.1 = 127.0.0.1:1883

web_mqtt.tcp.ip=127.0.0.1
web_mqtt.tcp.port=15675

虽然配置适用于

AMQP (5672)
Management (15672) and 
mqtt (1883) 

web_mqtt(15675)失败。

$ journalctl -xe
{{shutdown,{failed_to_start_child,ranch_acceptors_sup,badarg}},
{child,undefined, {ranch_listener_sup,web_mqtt},
{ranch_listener_sup,start_link, [web_mqtt,10,ranch_tcp, [{connection_type,supervisor},{ip,"127.0.0.1"},{port,15675}],
rabbit_web_mqtt_connection_sup, Mar 20 16:32:07 visiongui rabbitmq-server[9069]:                   #{env =>
#{dispatch =>
{'_',[],
[{[<<"ws">>],[],rabbit_web_mqtt_handler,[]}]}]},
middlewares =>
[cowboy_router,rabbit_web_mqtt_middleware, cowboy_handler]}]},
permanent,infinity,supervisor,
[ranch_listener_sup]}}}},
[{rabbit_web_mqtt_app,mqtt_init,0,
[{file,"src/rabbit_web_mqtt_app.erl"},{line,65}]},
{rabbit_web_mqtt_app,start,2,
[{file,"src/rabbit_web_mqtt_app.erl"},{line,31}]},
{application_master,start_it_old,4,
 [{file,"application_master.erl"},{line,273}]}]}}}}}}
Log file(s) (may contain more information):
/var/log/rabbitmq/rabbit@visiongui.log
 /var/log/rabbitmq/rabbit@visiongui_upgrade.log
{"init terminating in do_boot",{could_not_start,rabbitmq_web_mqtt,{rabbitmq_web_mqtt,{bad_return,{{rabbit_web_mqtt_app,start,[normal,[]]},{'EXIT',{{badmatc
init terminating in do_boot ({could_not_start,rabbitmq_web_mqtt,{rabbitmq_web_mqtt,{bad_return,{{_},{_}}}}})

1 个答案:

答案 0 :(得分:1)

RabbitMQ团队监控this mailing list,有时只回答StackOverflow上的问题。

web_mqtt设置如何转换为Erlang术语似乎存在错误。我已提交了一个问题here,以防你想跟进。

与此同时,我建议在您的环境中使用/etc/rabbitmq/rabbitmq.conf/etc/rabbitmq/advanced.config个文件的组合。

rabbitmq.conf应该包含以下内容:

listeners.tcp.1 = 127.0.0.1:5672
management.listener.ip = 127.0.0.1
management.listener.port = 15672
mqtt.listeners.tcp.1 = 127.0.0.1:1883

/etc/rabbitmq/advanced.config应该包含以下内容:

[
    {rabbitmq_web_mqtt, [
        {tcp_config, [
            {ip, {127,0,0,1}},
            {port, 15675}
        ]}
    ]}
].

如果这可以解决您的问题,请与我们联系。