RabbitMQ breaks when you rename hostname

posted in: Uncategorized | 0

I’ve been setting up a Debian 6 server with RabbitMQ installed. RabbitMQ is used with Celery to enable asynchronous tasks in Python Django projects. After installing RabbitMQ in one of my servers, I wanted to rename my server’s hostname. That broke RabbitMQ. RabbitMQ failed to start because its database is tied to the hostname. Removing the old installation of RabbitMQ will fix this problem.

Here are steps to reinstall RabbitMQ. These commands are run as the root user:

Step 1. Stop RabbitMQ: rabbitmqctl stop

Step 2. Change /etc/hosts

Step 3. Change /etc/hostname

Step 4. Uninstall old RabbitMQ: dpkg -P rabbitmq-server

Step 5. Remove RabbitMQ’s database: rm -rf /var/lib/rabbitmq

Step 6. Find erlang’s process that is running rabbit: ps ax | grep rabbit

Step 7. Kill the listed process

Step 8. Reinstall RabbitMQ: apt-get install rabbitmq-server

 

For further reading, I referenced several articles to get a handle on reinstalling RabbitMQ.