rabbitmq-server fails to start after hostname has changed for first time

Jinesh picture Jinesh · Feb 2, 2013 · Viewed 71.8k times · Source

I am using django-celery for my django project. Last day I have changed my computer's hostname (I am using Ubuntu 12.04, edited file '/etc/hostname'), and after next restart django-celery was failing with error

Consumer: Connection Error: [Errno 111] Connection refused. Trying again in 4 seconds...

After some research on this error I could find that, changing my host name caused this error from here. My rabbitmq startup log shows

file: /var/log/rabbitmq/startup_log

Activating RabbitMQ plugins ...

********************************************************************************
********************************************************************************

0 plugins activated:

ERROR: epmd error for host "jinesh": nxdomain (non-existing domain)

My startup_err file is empty.

when I run

root@jinesh:/home/jinesh# rabbitmqctl list_users
Listing users ...
Error: unable to connect to node rabbit@jinesh: nodedown

DIAGNOSTICS
===========

nodes in question: [rabbit@jinesh]

hosts, their running nodes and ports:
- unable to connect to epmd on jinesh: nxdomain

current node details:
- node name: rabbitmqctl4956@jinesh
- home dir: /var/lib/rabbitmq
- cookie hash: RGhmB2JR1LbZ57j7xWWTxg==

I hope changing the nodename may fix this issue. But I couldn't found a way to do this. Anyone have idea about how solve this issue?

update

while changing hostname you have to change both /etc/hostname and /etc/hosts files.

I reinstalled rabbitmq and solved this issue, Will answer this question.

Answer

Richard H Fung picture Richard H Fung · Jun 7, 2013

Remove the old installation of RabbitMQ to fix this problem. Here are steps to reinstall RabbitMQ. These commands are run as the root user:

  1. Stop RabbitMQ: rabbitmqctl stop

  2. Change /etc/hosts

  3. Change /etc/hostname

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

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

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

  7. Kill the listed process

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

I wrote about these steps on my blog.

REVISION

I moved my blog to a new website.