Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rabbit - Error: mnesia_unexpectedly_running

I am trying to cluster rabbit using chef

Here is my error. I shutdown all of rabbit on the second node.

rabbitmqctl join_cluster --ram rabbit@ip-10-158-xxx-xxx

Error: mnesia_unexpectedly_running

So..what is the deal? I tried this from http://agiletesting.blogspot.com/2010/05/rabbitmq-clustering-in-ubuntu.html which is to remove /var/lib/rabbitmq/mnesia. No go. And on what server doen it not be be running? All?

Thanks

like image 518
Tampa Avatar asked Jan 03 '13 00:01

Tampa


3 Answers

Make sure you call sudo rabbitmqctl stop_app before issuing the cluster command. That seemed to be the problem for me.

Then make sure you call sudo rabbitmqctl start_app to begin it again :)

like image 175
jocull Avatar answered Nov 13 '22 05:11

jocull


To call out a very important piece of @Itai Ganot's comment that's not immediately intuitive: you need to run rabbitmqctl stop_app on all nodes but one. If you run rabbitmqctl stop_app on all nodes, you will get a different message: Error: mnesia_not_running.

In short:

  • Error: mnesia_unexpectedly_running means "you need to run rabbitmqctl stop_app on this node
  • Error: mnesia_not_running means "you need to run rabbitmqctl start_app on the node you're trying to cluster with"
like image 40
Chris Chandler Avatar answered Nov 13 '22 04:11

Chris Chandler


You need to copy the cookie from the node you trying to connect

Let us use an example with 2 nodes: rabbit@node1 and rabbit@node2

  1. Go to rabbit@node1 and copy the cookie from cat /var/lib/rabbitmq/.erlang.cookie
  2. Go to rabbit@node2 remove the current cookie and paste the new one.
  3. Execute the following commands on the same node

    /usr/sbin/rabbitmqctl stop_app
    /usr/sbin/rabbitmqctl reset
    /usr/sbin/rabbitmqctl cluster rabbit@node1
    

That should do it.

The same procedure is documented here

like image 3
user2348359 Avatar answered Nov 13 '22 06:11

user2348359