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.