RabbitMQ: users disappear / settings gone after reboot / restart

RabbitMQ: users disappear / settings gone after reboot / restartIf you are using RabbitMQ on am Amazon EC2 instance and your node settings and users seem to disappear on reboot, it may be because of how the RabbitMQ server works.

Settings, users, vhosts, and the rest of the RabbitMQ are all bound based on the node name – or the hostname. You can check by running either `hostname` or `hostname -f` for the FQDN.

You will also notice that RabbitMQ stores settings in:

/var/lib/rabbitmq/

And more specifically in:

/var/lib/rabbitmq/mnesia

If you check the contents you will see something like:

drwxr-xr-x 5 rabbitmq rabbitmq 4096 Feb 27 14:55 rabbit@ip-10-110-58-254/
drwxr-xr-x 2 rabbitmq rabbitmq 4096 Feb 27 14:55 rabbit@ip-10-110-58-254-plugins-expand/
drwxr-xr-x 5 rabbitmq rabbitmq 4096 Feb 25 15:08 rabbit@ip-10-21-004-149/
drwxr-xr-x 2 rabbitmq rabbitmq 4096 Feb 25 14:41 rabbit@ip-10-21-004-149-plugins-expand/
drwxr-xr-x 5 rabbitmq rabbitmq 4096 Feb 23 04:48 rabbit@ip-10-21-043-37/
-rw-r–r– 1 rabbitmq rabbitmq 5 Feb 23 04:41 [email protected]
drwxr-xr-x 2 rabbitmq rabbitmq 4096 Feb 23 04:41 rabbit@ip-10-21-043-37-plugins-expand/
drwxr-xr-x 4 rabbitmq rabbitmq 4096 Feb 18 17:31 rabbit@ip-10-21-05-95/
drwxr-xr-x 2 rabbitmq rabbitmq 4096 Feb 18 17:28 rabbit@ip-10-21-05-95-plugins-expand/
drwxr-xr-x 4 rabbitmq rabbitmq 4096 Feb 26 15:32 rabbit@ip-10-21-037-208/
drwxr-xr-x 2 rabbitmq rabbitmq 4096 Feb 26 15:26 rabbit@ip-10-21-037-208-plugins-expand/

##Why do RabbitMQ settings disappear on restart?

Well, if you “stop” an amazon ec2 instance and then “start” it, it will have a new IP address unless you are using static IP addresses. Note that this doesn’t happen on “reboots” – just “stop” and “start” for EBS / (Elastic Block Storage) volumes. If you are not using an EBS volume then the whole settings directory will get erased when you stop/start the instance – so look into EBS if you are not using them.

The RabbitMQ server binds settings by default to the FQDN which with amazon ec2 is tied to the IP address / Amazon internal DNS system.

One way to resolve this issue would be to use a static IP address and make sure it gets assigned on startup.

Another way would be to create a file here:

/etc/rabbitmq/rabbitmq.conf.d/hostname.conf

With the contents:

NODENAME=rabbit@localhost

That works on Ubuntu 12.04.

Related Posts:

  • No Related Posts
This entry was posted in Linux, Server Administration. Bookmark the permalink.

3 Responses to RabbitMQ: users disappear / settings gone after reboot / restart

Leave a Reply

Your email address will not be published. Required fields are marked *