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 [email protected]/
drwxr-xr-x  2 rabbitmq rabbitmq 4096 Feb 27 14:55 [email protected]/
drwxr-xr-x  5 rabbitmq rabbitmq 4096 Feb 25 15:08 [email protected]/
drwxr-xr-x  2 rabbitmq rabbitmq 4096 Feb 25 14:41 [email protected]/
drwxr-xr-x  5 rabbitmq rabbitmq 4096 Feb 23 04:48 [email protected]/
-rw-r--r--  1 rabbitmq rabbitmq    5 Feb 23 04:41 [email protected]
drwxr-xr-x  2 rabbitmq rabbitmq 4096 Feb 23 04:41 [email protected]/
drwxr-xr-x  4 rabbitmq rabbitmq 4096 Feb 18 17:31 [email protected]/
drwxr-xr-x  2 rabbitmq rabbitmq 4096 Feb 18 17:28 [email protected]/
drwxr-xr-x  4 rabbitmq rabbitmq 4096 Feb 26 15:32 [email protected]/
drwxr-xr-x  2 rabbitmq rabbitmq 4096 Feb 26 15:26 [email protected]/

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:

[email protected]

That works on Ubuntu 12.04.

Related Posts:

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

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

  1. Marcos Martínez says:

    In CentOS 5.1 (rabbitmq 3.1.4) the rabbitmq.conf.d folder does not exists, but you can also use /etc/rabbitmq/rabbitmq-env.conf and drop there the NODENAME env var.

  2. seshu says:

    Hi,

    My doubt may sound stupid. I created a android IM app with Cloudamqp to push. To test the app i want to use a rabbitmq server on ec2. After setting up server on ec2. what details we will get from the server to use them in consumers to connect. Please answer asap.

    Thank you very much.

Leave a Reply

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