4

General rule for RabbitMQ to start cluster after shutting down all the nodes is to first start the node that was stopped last during shut down process, then start the rest. Lets say shutdown process is initiated by some external script which doesn't save the state, and because of that I don't know explicitly which node was stopped last when I want to start them. Does RabbitMQ provide some means to find out which node was shut down last?

I found a file in /var/lib/rabbitmq/mnesia/<node> called nodes_running_at_shutdown which seems to hold the information about the nodes running during shut down. Based on that I figured out that the last node would have only one node in that file (itself), and I actually confirmed that empirically, however I could not find any documentation for that file so I'm not sure whether this solution doesn't have some corner cases (besides the obvious downside that it's undocumented and can change at any moment).

Is there any recommended way to find out the node that was stopped last?

EDIT: My question is more about whether we can retrieve the state from RabbitMQ itself, without external tools that would persist the state between stop and start processes.

1 Answer 1

0

If you're sending data (stats, logs, etc) to an external service (graphite/collectd/ganglia/etc or logstash/splunk/syslogd), you could look at (or better yet, query) one of them for the host that last sent data.

2
  • I guess my question was ambiguous, I've added some clarification. Basically I'm asking if there is a way to retrieve that order without using external tools. The only thing that I can assume about target environment is that it's Linux, and that RabbitMQ is there, nothing else :).
    – kars7e
    Dec 24, 2014 at 1:44
  • Were this my problem to solve, I would have ship the 'nodes running at shutdown' value to Logstash, and send a binary value to graphite of whether RabbitMQ is running. Without those kinds of facilities, I don't know what I would do other than check that value on the cluster nodes.
    – gWaldo
    Dec 24, 2014 at 1:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .