我正在尝试配置RabbitMQ - MQTT插件。但是一旦启用了插件,我就无法重启服务。
我遵循了在文档中找到的指南:https://www.rabbitmq.com/mqtt.html
重温我的行动:
我使用命令
启用了该插件sudo rabbitmq-plugins enable rabbitmq_mqtt
这是回复
[root@iot-rabbit01 rabbitmq]# rabbitmq-plugins enable rabbitmq_mqtt
The following plugins have been enabled:
rabbitmq_mqtt
Applying plugin configuration to rabbit@iot-rabbit01... failed.
Error: {could_not_start,rabbitmq_mqtt,
{{shutdown,
{failed_to_start_child,'rabbit_mqtt_listener_sup_:::1883',
{shutdown,
{failed_to_start_child,
{ranch_listener_sup,{acceptor,{0,0,0,0,0,0,0,0},1883}},
{shutdown,
{failed_to_start_child,ranch_acceptors_sup,
{listen_error,{acceptor,{0,0,0,0,0,0,0,0},1883},eacces}}}}}}},
{rabbit_mqtt,start,[normal,[]]}}}
所以我打印了启用的插件列表
[root@iot-rabbit01 rabbitmq]# rabbitmq-plugins list
Configured: E = explicitly enabled; e = implicitly enabled
| Status: [failed to contact rabbit@iot-rabbit01 - status not shown]
|/
[e ] amqp_client 3.6.1
[ ] cowboy 1.0.3
[ ] cowlib 1.0.1
[e ] mochiweb 2.13.0
[ ] rabbitmq_amqp1_0 3.6.1
[ ] rabbitmq_auth_backend_ldap 3.6.1
[ ] rabbitmq_auth_mechanism_ssl 3.6.1
[ ] rabbitmq_consistent_hash_exchange 3.6.1
[ ] rabbitmq_event_exchange 3.6.1
[ ] rabbitmq_federation 3.6.1
[ ] rabbitmq_federation_management 3.6.1
[E ] rabbitmq_management 3.6.1
[e ] rabbitmq_management_agent 3.6.1
[ ] rabbitmq_management_visualiser 3.6.1
[E ] rabbitmq_mqtt 3.6.1
[ ] rabbitmq_recent_history_exchange 1.2.1
[ ] rabbitmq_sharding 0.1.0
[ ] rabbitmq_shovel 3.6.1
[ ] rabbitmq_shovel_management 3.6.1
[ ] rabbitmq_stomp 3.6.1
[ ] rabbitmq_tracing 3.6.1
[e ] rabbitmq_web_dispatch 3.6.1
[ ] rabbitmq_web_stomp 3.6.1
[ ] rabbitmq_web_stomp_examples 3.6.1
[ ] sockjs 0.3.4
[e ] webmachine 1.10.3
正如您所看到的,[E ] rabbitmq_management 3.6.1
插件已明确启用。
所以我试着启动服务
[root@iot-rabbit01 rabbitmq]# /sbin/service rabbitmq-server start
Starting rabbitmq-server (via systemctl): [ OK ]
似乎正确启动了。但事实并非如此。
[root@iot-rabbit01 rabbitmq]# rabbitmqctl status
Status of node 'rabbit@iot-rabbit01' ...
Error: unable to connect to node 'rabbit@iot-rabbit01': nodedown
DIAGNOSTICS
===========
attempted to contact: ['rabbit@iot-rabbit01']
rabbit@iot-rabbit01:
* connected to epmd (port 4369) on iot-rabbit01
* epmd reports: node 'rabbit' not running at all
no other nodes on iot-rabbit01
* suggestion: start the node
current node details:
- node name: 'rabbitmq-cli-23@iot-rabbit01'
- home dir: /var/lib/rabbitmq
- cookie hash: pNNE23Tq7SUKunVAXkqReg==
这是startup_log
RabbitMQ 3.6.1. Copyright (C) 2007-2016 Pivotal Software, Inc.
## ## Licensed under the MPL. See http://www.rabbitmq.com/
## ##
########## Logs: /var/log/rabbitmq/rabbit@iot-rabbit01.log
###### ## /var/log/rabbitmq/rabbit@iot-rabbit01-sasl.log
##########
Starting broker...
BOOT FAILED
===========
Error description:
{could_not_start,rabbitmq_mqtt,
{{shutdown,
{failed_to_start_child,'rabbit_mqtt_listener_sup_:::1883',
{shutdown,
{failed_to_start_child,
{ranch_listener_sup,{acceptor,{0,0,0,0,0,0,0,0},1883}},
{shutdown,
{failed_to_start_child,ranch_acceptors_sup,
{listen_error,
{acceptor,{0,0,0,0,0,0,0,0},1883},
eacces}}}}}}},
{rabbit_mqtt,start,[normal,[]]}}}
Log files (may contain more information):
/var/log/rabbitmq/rabbit@iot-rabbit01.log
/var/log/rabbitmq/rabbit@iot-rabbit01-sasl.log
{"init terminating in do_boot",{could_not_start,rabbitmq_mqtt,{{shutdown,{failed_to_start_child,'rabbit_mqtt_listener_sup_:::1883',{shutdown,{failed_to_start_child,{ranch_listener_sup,{acceptor,{0,0,0,0,0,0,0,0},1883}},{shutdown,{failed_to_start_child,ranch_acceptors_sup,{listen_error,{acceptor,{0,0,0,0,0,0,0,0},1883},eacces}}}}}}},{rabbit_mqtt,start,[normal,[]]}}}}
这是/var/log/rabbitmq/rabbit@iot-rabbit01.log
文件
=ERROR REPORT==== 24-Jan-2017::11:43:53 ===
Failed to start Ranch listener {acceptor,{0,0,0,0,0,0,0,0},1883} in ranch_tcp:listen([{port,
1883},
{ip,
{0,
0,
0,
0,
0,
0,
0,
0}},
inet6,
{backlog,
128},
{nodelay,
true}]) for reason eacces (permission denied)
=INFO REPORT==== 24-Jan-2017::11:43:53 ===
stopped TCP Listener on [::]:5672
=INFO REPORT==== 24-Jan-2017::11:43:53 ===
Error description:
{could_not_start,rabbitmq_mqtt,
{{shutdown,
{failed_to_start_child,'rabbit_mqtt_listener_sup_:::1883',
{shutdown,
{failed_to_start_child,
{ranch_listener_sup,{acceptor,{0,0,0,0,0,0,0,0},1883}},
{shutdown,
{failed_to_start_child,ranch_acceptors_sup,
{listen_error,
{acceptor,{0,0,0,0,0,0,0,0},1883},
eacces}}}}}}},
{rabbit_mqtt,start,[normal,[]]}}}
如果您需要更多信息,请与我联系。 非常感谢。
答案 0 :(得分:1)
我修正了我的问题。谁会有同样的问题。
该插件无法绑定到端口1883,因为内核已响应 与EACCESS错误。某种安全工具(最有可能的 SELinux)需要将该端口列入白名单。
更改SELinux参数我能解决我的问题。这可以通过两种方式实现
/etc/selinux/config
将字符串SELINUX=enforcing
编辑为SELINUX=permissive
或进入(注意,这是一个安全错误)SELINUX=disabled
semanage port --add
端口1883 答案 1 :(得分:0)
我有同样的问题。另一个mqtt经纪人已经在1883端口上运行…
可能会帮助某些遇到此问题的人。