2014-01-09 95 views
3

几个问题有关的RabbitMQ v3.1.5集群。 我有一个2个节点的集群,rabbitmq.config是这样的两个节点上:RabbitMQ的不一致集群

[ 
    {rabbit, [ 
    {cluster_nodes, {['[email protected]', '[email protected]'], ram}}, 
    {tcp_listeners, [5674]} 
    ]} 
]. 

我已经看到了问题,像这样的,现在我又看着它: 时,有时会所有集群关停,如果第二个节点(rmq02)开始之前,首先(rmq01),它忘记'约rmq01:

[[email protected] rabbitmq]# rabbitmqctl cluster_status 
Cluster status of node '[email protected]' ... 
[{nodes,[{disc,['[email protected]']}]}, 
{running_nodes,['[email protected]']}, 
{partitions,[]}] 
...done. 

这第一个节点(rmq01)后,由于rmq2不同意有关集群无法启动:

{"init terminating in do_boot",{rabbit,failure_during_boot,{error,{inconsistent_cluster,"Node '[email protected]' thinks it's clustered with node '[email protected]', but '[email protected]' disagrees"}}}} 

我试图添加rmq01到rmq02,但看来我这个前stop_app:

[[email protected] rabbitmq]# rabbitmqctl join_cluster [email protected] 
Clustering node '[email protected]' with '[email protected]' ... 
Error: mnesia_unexpectedly_running 

在这里,我看到rmq02忘了rmq01:

[[email protected] ~]# cat /var/lib/rabbitmq/mnesia/rabbit\@rmq2/cluster_nodes.config 
{['[email protected]'],['[email protected]']}. 

同时对rmq01(正确的配置):

[[email protected] ~]# cat /var/lib/rabbitmq/mnesia/rabbit\@rmq1/cluster_nodes.config 
{['[email protected]','[email protected]'],['[email protected]']}. 

问题:

  1. 是正常rmq02忘掉rmq01,或者我有一些missconfiguration?这是为什么发生?
  2. 万一没关系,是否有可能修复群集的健康没有rmq02停机时间(我的意思是没有stop_app)?

回答

11

我已经找到方法来解决问题2,修复了群集运行状况而无需停机,我们需要删除不一致的节点上的所有Mnesia的数据:

[[email protected] ~]# rm -rf /var/lib/rabbitmq/mnesia/ 

[[email protected] ~]# service rabbitmq-server start 
Starting rabbitmq-server: SUCCESS 
rabbitmq-server. 
[[email protected] ~]# rabbitmqctl cluster_status 
Cluster status of node '[email protected]' ... 
[{nodes,[{disc,['[email protected]']},{ram,['[email protected]']}]}, 
{running_nodes,['[email protected]','[email protected]']}, 
{partitions,[]}] 
...done. 

我还是不明白如何为了避免这种情况(问题#1),也许一些mnesia定制会有所帮助。

+0

非常有帮助。 :) –

+1

注意:对于Windows mnesia文件夹位于'C:\ Users \ \ AppData \ Roaming \ RabbitMQ \ db'中。我删除了一个节点上的文件夹,我无法恢复,并且工作。谢谢! –

+0

我在'/ var/log/rabbitmq/startup_log'中看到'error,corrupt_cluster_status_files'。删除mnesia目录并重新启动服务可解决问题。 – Waseem