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

后端 未结 13 1989
予麋鹿
予麋鹿 2021-02-01 12:43

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

相关标签:
13条回答
  • 2021-02-01 12:50

    When on Windows (sorry about that - I understand the topic is for Ubuntu) just reinstall the RabbitMQ service:

    rabbitmq-service.bat remove
    rabbitmq-service.bat install
    

    The script is located at C:\Program Files\RabbitMQ Server\rabbitmq_server-<version>\sbin folder.

    Or may be just changing the value of HKEY_LOCAL_MACHINE\SOFTWARE\Ericsson\Erlang\ErlSrv\1.1\RabbitMQ\@SName is enough.

    Clues: https://github.com/rabbitmq/rabbitmq-server/issues/620

    0 讨论(0)
  • 2021-02-01 12:53

    Check qpidd daemon, it could be also already hogging the port that rabbitmq needs.

    sudo netstat -lnp
    
    0 讨论(0)
  • 2021-02-01 12:54

    On Windows, the issue I was facing was due to the McAfee firewall. The exact error was:

    epmd error for host "<HOSTNAME>": address (cannot connect to host/port)

    It started working as soon as I disabled the firewall

    0 讨论(0)
  • 2021-02-01 12:57

    Richard's answer is good, but you might lose some information in the rabbitmq queues. The following is a possible way to preserve the previous setup of rabbitmq with the new host name.

    A Short Answer:

    If you want to keep the new host name change, then you can create a rabbitmq-env.conf files in /etc/rabbitmq that references the old host name and all should be good. The following is what should be in the rabbitmq-env.conf file:

    NODENAME=rabbit@OLDHOSTNAME
    

    After adding the config file, restart the rabbitmq server then you should be good. (e.g. service rabbitmq-server restart (might need a sudo with ubuntu))

    For more details you can read from the rabbitmq website: https://www.rabbitmq.com/man/rabbitmq-env.conf.5.man.html

    More Details About the Answer:

    I had a similar hostname issues using CentOS... The root issue was when rabbit installs, it references the current host name at the time of install. Since this is a rabbitmq thing, the solution should work for other linux flavors. If you want to see the full answer, you can see it at: rabbtimqadmin - Could not connect: [Errno -2] Name or service not known

    0 讨论(0)
  • 2021-02-01 13:01

    My solution was to check and correct the $HOSTNAME and /etc/hostname. It turned out that my router was a little confused and gave me a wrong hostname domain. After restarting this one, I called export HOSTNAME=the.correct.hostname and my rabbit runs without restarting the server os.

    0 讨论(0)
  • 2021-02-01 13:03

    You could solve this problem by either deleting the erlang mnesia database associated with rabbitmq or reinstalling rabbitmq.

    I got hint for first solution from rabbitmq mailing list. Excerpt from answer, The Erlang Mnesia database is host specific (because it is a distributed DB). The simplest way to get you fixed is to clear out the database dir.

    The second method is the easiest way (not recommend though). To uninstall do

    dpkg -P rabbitmq-server
    

    You can refer this link if you would like to know more about installing/removing debian packages.

    0 讨论(0)
提交回复
热议问题