[rabbitmq-discuss] A cluster on a single machine

David Fooks davidfooks at turbulenz.biz
Tue May 8 10:58:40 BST 2012


Right after a hint about using RABBITMQ_PID_FILE (without -detached) I now 
have four scripts. The first 3 are one line scripts run in separate tabs:

RABBITMQ_NODE_PORT=5672 RABBITMQ_PID_FILE="/var/run/rabbitmq/rabbit1.pid" 
RABBITMQ_NODENAME=rabbit1 RABBITMQ_SERVER_START_ARGS="-rabbitmq_mochiweb 
listeners [{mgmt,[{port,55672}]}]" rabbitmq-server
RABBITMQ_NODE_PORT=5673 RABBITMQ_PID_FILE="/var/run/rabbitmq/rabbit2.pid" 
RABBITMQ_NODENAME=rabbit2 RABBITMQ_SERVER_START_ARGS="-rabbitmq_mochiweb 
listeners [{mgmt,[{port,55673}]}]" rabbitmq-server
RABBITMQ_NODE_PORT=5674 RABBITMQ_PID_FILE="/var/run/rabbitmq/rabbit3.pid" 
RABBITMQ_NODENAME=rabbit3 RABBITMQ_SERVER_START_ARGS="-rabbitmq_mochiweb 
listeners [{mgmt,[{port,55674}]}]" rabbitmq-server

Viewing the outputs of these shows that they all have the same cookie hash.

I then run the following start up script:

rabbitmqctl -n rabbit1 wait /var/run/rabbitmq/rabbit1.pid
rabbitmqctl -n rabbit2 wait /var/run/rabbitmq/rabbit2.pid
rabbitmqctl -n rabbit3 wait /var/run/rabbitmq/rabbit3.pid

rabbitmqctl -n rabbit1 stop_app
rabbitmqctl -n rabbit1 reset
rabbitmqctl -n rabbit1 start_app

rabbitmqctl -n rabbit2 stop_app
rabbitmqctl -n rabbit2 reset
rabbitmqctl -n rabbit2 start_app

rabbitmqctl -n rabbit1 wait /var/run/rabbitmq/rabbit1.pid
rabbitmqctl -n rabbit2 wait /var/run/rabbitmq/rabbit2.pid

rabbitmqctl -n rabbit1 status
rabbitmqctl -n rabbit2 status

rabbitmqctl -n rabbit3 stop_app
rabbitmqctl -n rabbit3 reset
rabbitmqctl -n rabbit3 cluster rabbit1 at dfooks-ubuntu64 
rabbit2 at dfooks-ubuntu64
rabbitmqctl -n rabbit3 start_app

rabbitmqctl -n rabbit3 wait /var/run/rabbitmq/rabbit3.pid

rabbitmqctl -n rabbit3 status

But I'm still seeing the following error:

Clustering node 'rabbit3 at dfooks-ubuntu64' with ['rabbit1 at dfooks-ubuntu64',
                                                'rabbit2 at dfooks-ubuntu64'] 
...
Error: {unable_to_join_cluster,
           ['rabbit1 at dfooks-ubuntu64','rabbit2 at dfooks-ubuntu64'],
           {merge_schema_failed,
               "Incompatible schema cookies. Please, restart from old 
backup.'rabbit1 at dfooks-ubuntu64' = 
[{name,schema},{type,set},{ram_copies,[]},{disc_copies,['rabbit1 at dfooks-ubuntu64']},{disc_only_copies,[]},{load_order,0},{access_mode,read_write},{index,[]},{snmp,[]},{local_content,false},{record_name,schema},{attributes,[table,cstruct]},{user_properties,[]},{frag_properties,[]},{cookie,{{1336,470172,840474},'rabbit1 at dfooks-ubuntu64'}},{version,{{3,0},{'rabbit1 at dfooks-ubuntu64',{1336,470175,994704}}}}], 
'rabbit3 at dfooks-ubuntu64' = 
[{name,schema},{type,set},{ram_copies,['rabbit3 at dfooks-ubuntu64']},{disc_copies,['rabbit2 at dfooks-ubuntu64']},{disc_only_copies,[]},{load_order,0},{access_mode,read_write},{index,[]},{snmp,[]},{local_content,false},{record_name,schema},{attributes,[table,cstruct]},{user_properties,[]},{frag_properties,[]},{cookie,{{1336,470173,940236},'rabbit2 at dfooks-ubuntu64'}},{version,{{3,0},{'rabbit3 at dfooks-ubuntu64',{1336,470176,11792}}}}]\n"}}

So now I am resetting the node but I'm still seeing this issue. Any ideas? 
I might give up and use 2 VMs.

On Friday, 4 May 2012 17:53:29 UTC+1, David Fooks wrote:
>
> Ok the above script is missing something:
>
> ...
> rabbitmqctl -n rabbit3 stop_app
> rabbitmqctl -n rabbit3 reset
> rabbitmqctl -n rabbit3 cluster rabbit1 at dfooks-ubuntu64 
> rabbit2 at dfooks-ubuntu64
> rabbitmqctl -n rabbit3 start_app
>
> But this after this change I still get the error.
>
> On Friday, 4 May 2012 17:46:29 UTC+1, David Fooks wrote:
>>
>> Hi,
>>
>> I'm trying to emulate the guide here: 
>> http://www.rabbitmq.com/clustering.html
>>
>> But I'm having a lot of issues! Every time I run I seem to be getting a 
>> different crash. Is this feature actually supported in 2.8.1?
>>
>> Is there a proper way to completely reset all of the state that rabbitmq 
>> creates about other nodes/the cluster? My clean up script at the moment 
>> looks like this:
>>
>> rm /var/run/rabbitmq/*
>> rm -f /var/log/rabbitmq/*
>> rm -rf /var/lib/rabbitmq/*
>>
>> Here is my start-up script (I'm running this with sudo):
>>
>> RABBITMQ_NODE_PORT=5672 RABBITMQ_NODENAME=rabbit1 
>> RABBITMQ_SERVER_START_ARGS="-rabbitmq_mochiweb listeners 
>> [{mgmt,[{port,55672}]}]" rabbitmq-server -detached
>> RABBITMQ_NODE_PORT=5673 RABBITMQ_NODENAME=rabbit2 
>> RABBITMQ_SERVER_START_ARGS="-rabbitmq_mochiweb listeners 
>> [{mgmt,[{port,55673}]}]" rabbitmq-server -detached
>> RABBITMQ_NODE_PORT=5674 RABBITMQ_NODENAME=rabbit3 
>> RABBITMQ_SERVER_START_ARGS="-rabbitmq_mochiweb listeners 
>> [{mgmt,[{port,55674}]}]" rabbitmq-server -detached
>>
>> ps -ef | grep rabbit1 | grep -v grep | awk '{print $2}' > 
>> /var/run/rabbitmq/rabbit1.pid
>> ps -ef | grep rabbit2 | grep -v grep | awk '{print $2}' > 
>> /var/run/rabbitmq/rabbit2.pid
>> ps -ef | grep rabbit3 | grep -v grep | awk '{print $2}' > 
>> /var/run/rabbitmq/rabbit3.pid
>>
>> rabbitmqctl -n rabbit1 wait /var/run/rabbitmq/rabbit1.pid
>> rabbitmqctl -n rabbit2 wait /var/run/rabbitmq/rabbit2.pid
>> rabbitmqctl -n rabbit3 wait /var/run/rabbitmq/rabbit3.pid
>>
>> rabbitmqctl -n rabbit1 stop_app
>> rabbitmqctl -n rabbit1 reset
>> rabbitmqctl -n rabbit1 start_app
>>
>> rabbitmqctl -n rabbit2 stop_app
>> rabbitmqctl -n rabbit2 reset
>> rabbitmqctl -n rabbit2 start_app
>>
>> rabbitmqctl -n rabbit3 stop_app
>> rabbitmqctl -n rabbit3 reset
>> rabbitmqctl -n rabbit3 start_app
>>
>> rabbitmqctl -n rabbit1 status
>> rabbitmqctl -n rabbit2 status
>> rabbitmqctl -n rabbit3 status
>>
>> rabbitmqctl -n rabbit3 stop_app
>> rabbitmqctl -n rabbit3 cluster rabbit1 at dfooks-ubuntu64 
>> rabbit2 at dfooks-ubuntu64
>> rabbitmqctl -n rabbit3 start_app
>>
>> If I run the "clean" script and then this script I get the following 
>> warning (after all of the status returns ok):
>>
>> ...
>> Stopping node 'rabbit3 at dfooks-ubuntu64' ...
>> ...done.
>> Clustering node 'rabbit3 at dfooks-ubuntu64' with ['rabbit1 at dfooks-ubuntu64',
>>                                                 
>> 'rabbit2 at dfooks-ubuntu64'] ...
>> Error: {unable_to_join_cluster,
>>            ['rabbit1 at dfooks-ubuntu64','rabbit2 at dfooks-ubuntu64'],
>>            {merge_schema_failed,
>>                "Incompatible schema cookies. Please, restart from old 
>> backup.'rabbit1 at dfooks-ubuntu64' = 
>> [{name,schema},{type,set},{ram_copies,[]},{disc_copies,['rabbit1 at dfooks-ubuntu64']},{disc_only_copies,[]},{load_order,0},{access_mode,read_write},{index,[]},{snmp,[]},{local_content,false},{record_name,schema},{attributes,[table,cstruct]},{user_properties,[]},{frag_properties,[]},{cookie,{{1336,149567,596521},'rabbit1 at dfooks-ubuntu64'}},{version,{{3,0},{'rabbit1 at dfooks-ubuntu64',{1336,149572,870479}}}}], 
>> 'rabbit3 at dfooks-ubuntu64' = 
>> [{name,schema},{type,set},{ram_copies,['rabbit3 at dfooks-ubuntu64']},{disc_copies,['rabbit2 at dfooks-ubuntu64']},{disc_only_copies,[]},{load_order,0},{access_mode,read_write},{index,[]},{snmp,[]},{local_content,false},{record_name,schema},{attributes,[table,cstruct]},{user_properties,[]},{frag_properties,[]},{cookie,{{1336,149568,520459},'rabbit2 at dfooks-ubuntu64'}},{version,{{3,0},{'rabbit3 at dfooks-ubuntu64',{1336,149572,882518}}}}]\n"}}
>> Starting node 'rabbit3 at dfooks-ubuntu64' ...
>> Error: {cannot_start_application,rabbitmq_management,
>>            {bad_return,
>>                {{rabbit_mgmt_app,start,[normal,[]]},
>>                 {'EXIT',
>>                     {shutdown,
>>                         {gen_server2,call,
>>                             
>> [<4885.932.0>,{init,<4885.930.0>},infinity]}}}}}}
>>
>> I've read about this error in other threads but it generally seems to be 
>> about network settings being reconfigured between nodes. I shouldn't have 
>> these problems since each instance is on the same machine.
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120508/27bb2d4f/attachment.htm>


More information about the rabbitmq-discuss mailing list