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

后端 未结 13 1988
予麋鹿
予麋鹿 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: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

提交回复
热议问题