RabbitMQ --- 常见问题
1、rabbitmq 启动错误 .erlang.cookie must be accessible by owner only
解决方法:
chmod 600 /var/lib/rabbitmq/.erlang.cookie
RabbitMQ 强制删除队列
有些情况下导致队列无法删除,可使用如下命令强制删除:
rabbitmqctl eval 'rabbit_amqqueue:internal_delete({resource,<<"/">>,queue,<<"cinder.info">>}).'
脑裂问题
现象是在 RabbitMQ GUI上显示
Network partition detected
Mnesia reports that this RabbitMQ cluster has experienced a network partition. There is a risk of losing data. Please read RabbitMQ documentation about network partitions and the possible solutions.
原因分析:
这是由于网络问题导致集群出现了脑裂
解决办法:
在相对不怎么信任的分区里,对那个分区的节点实行,在出现问题的节点上执行:
rabbitmqctl stop_app
rabbitmqctl reset
rabbitmqctl start_app
加入集群失败问题
[root@rabbitmq-102 rabbitmq]# rabbitmqctl join_cluster rabbit@rabbitmq-101 --ram
Clustering node 'rabbit@rabbitmq-102' with 'rabbit@rabbitmq-101'
Error: {inconsistent_cluster,"Node 'rabbit@rabbitmq-101' thinks it's clustered with node 'rabbit@rabbitmq-102', but 'rabbit@rabbitmq-102' disagrees"}
现在在节点 rabbitmq-101 运行的节点执行:
rabbitmqctl forget_cluster_node rabbitmq-102
# 然后在 rabbitmq-102 执行
rabbitmqctl join_cluster rabbit@rabbitmq-101 --ram
In some cases the last node to go offline cannot be brought back up. It can be removed from the cluster using the forget_cluster_node rabbitmqctl command.
Virtual host / experienced an error on node rabbit@ and may be inaccessible
查看RabbitMQ的日志,里面有很多类似如下错误:
/var/lib/rabbitmq/mnesia/rabbit@<hostname>/msg_stores/vhosts/9Q355W65BH1CKHLV81SV8HAB4/recovery.dets
修复方式:
停止RabbitMQ集群
删除错误的vhosts/9Q355W65BH1CKHLV81SV8HAB4文件
启动RabbitMQ集群