Programing

호스트 이름이 처음으로 변경된 후 rabbitmq-server가 시작되지 않음

lottogame 2021. 1. 6. 07:39
반응형

호스트 이름이 처음으로 변경된 후 rabbitmq-server가 시작되지 않음


내 django 프로젝트에 django-celery를 사용하고 있습니다. 어제 컴퓨터의 호스트 이름을 변경했으며 (Ubuntu 12.04를 사용하고 있으며, '/ etc / hostname'파일을 편집했습니다) 다음에 다시 시작한 후 django-celery가 오류와 함께 실패했습니다.

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

이 오류에 대해 조사한 후 호스트 이름을 변경하면 여기 에서이 오류가 발생했음을 알 수 있습니다 . 내 rabbitmq 시작 로그에

파일 : / var / log / rabbitmq / startup_log

Activating RabbitMQ plugins ...

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

0 plugins activated:

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

내 startup_err 파일이 비어 있습니다.

내가 달릴 때

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==

노드 이름을 변경하면이 문제가 해결되기를 바랍니다. 그러나 나는 이것을 할 방법을 찾지 못했습니다. 누구나이 문제를 해결하는 방법에 대해 알고 있습니까?

최신 정보

호스트 이름을 변경하는 동안 /etc/hostname/etc/hosts파일을 모두 변경해야 합니다.

rabbitmq를 다시 설치하고이 문제를 해결했습니다.이 질문에 답할 것입니다.


이 문제를 해결하려면 이전 RabbitMQ 설치를 제거하십시오. RabbitMQ를 다시 설치하는 단계는 다음과 같습니다. 다음 명령은 루트 사용자로 실행됩니다.

  1. RabbitMQ 중지 : rabbitmqctl stop

  2. 변화 /etc/hosts

  3. 변화 /etc/hostname

  4. 이전 RabbitMQ 제거 : dpkg -P rabbitmq-server

  5. RabbitMQ의 데이터베이스 제거 : rm -rf /var/lib/rabbitmq

  6. rabbit을 실행하는 erlang의 프로세스를 찾으십시오. ps ax | grep rabbit

  7. 나열된 프로세스 종료

  8. RabbitMQ를 다시 설치합니다. apt-get install rabbitmq-server

이 단계에 대해 블로그 에 썼습니다 .

개정

블로그를 새 웹 사이트로 옮겼습니다.


Richard H Fung에게 감사합니다.

그의 발걸음은이 문제를 해결하는 데 도움이되었습니다.

하지만 rabbitmq를 다시 설치할 필요가 없었습니다 .

/etc/hosts파일을 열었을 때 IP내 호스트 이름에 할당 된 것이 실제 ip(192.168.1.200 [static]).

#/etc/hosts  
127.0.0.1       localhost  
192.168.1.115   HOSTNAME

그래서 방금 파일 에서 IP 주소192.168.1.200변경 /etc/hosts했는데 제대로 작동했습니다.


Richard의 대답은 좋지만 rabbitmq 대기열에서 일부 정보를 잃을 수 있습니다. 다음은 새 호스트 이름으로 rabbitmq의 이전 설정을 보존하는 가능한 방법입니다.

짧은 답변 :

새 호스트 이름 변경을 유지 하려면 이전 호스트 이름을 참조 하는 rabbitmq-env.conf파일을 만들 수 /etc/rabbitmq있으며 모두 정상이어야합니다. 다음은 rabbitmq-env.conf파일에 있어야하는 내용입니다 .

NODENAME=rabbit@OLDHOSTNAME

설정 파일을 추가 한 후 rabbitmq 서버를 다시 시작하면 괜찮을 것입니다. (예 service rabbitmq-server restart( sudo우분투에 a가 필요할 수 있음 ))

자세한 내용은 rabbitmq 웹 사이트에서 읽을 수 있습니다 : https://www.rabbitmq.com/man/rabbitmq-env.conf.5.man.html

답변에 대한 자세한 내용 :

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


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.


On Windows, the issue I was facing was due to the McAfee firewall. The exact error was epmd error for host "": address (cannot connect to host/port)

It started working as soon as I disabled the firewall


Remove RabbitMQ database: rm -rf /var/lib/rabbitmq/*

This action solves the problem. I believe somewhere in dumps stored a record with correspondence of nodes host names and ips. This fact causes contradiction if some hosts changed unexpectedly.


In my case I did not have a following entry in /etc/hosts:

127.0.0.1 <hostname>

where <hostname> is the hostname of my machine (as given by the hostname command). After adding that line, RabbitMQ started successfully. I did not have any earlier installations of RabbitMQ.


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.


I had the same problem and doing the steps Richard H Fung provided didn't helped me. I also had to uninstall these packages: erlang erlang-epmd rabbitmq-server

zypper remove erlang erlang-epmd rabbitmq-server
rm -rf /var/lib/rabbitmq/*
zypper install erlang erlang-epmd rabbitmq-server
systemctl enable rabbitmq-server.service
systemctl start rabbitmq-server.service

If you have another OS than openSUSE just use your package manager to remove these packages (e.g. apt-get)


To solve this problem, I changed my /etc/hostname file with the new hostname then restarted the machine. After that, I ran rm -rf /var/lib/rabbitmq/mnesia/*

Then restarted the service : sudo service rabbitmq-server restart

At this point, it worked for me. If it still don't work, modify the file /etc/rabbitmq/rabbitmq-env.conf by adding those informations :

NODENAME=rabbit@YOUR_NEW_HOSTNAME
NODE_IP_ADDRESS=127.0.0.1
NODE_PORT=5672

Then restart the service : sudo service rabbitmq-server restart

Hope it helps.


The only solution which work for me: install erlang & rabbitmq from deb, so:

First remove:

apt-get purge rabbitmq-server
apt-get purge erlang
apt-get autoremove
reboot

After install wget:

sudo apt-get -y install socat logrotate init-system-helpers adduser
sudo apt-get -y install wget

Install erlang:

wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
sudo dpkg -i erlang-solutions_1.0_all.deb
sudo apt-get update
sudo apt-get install erlang

Install rabbitmq:

sudo apt-get update
wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.17/rabbitmq-server_3.7.17-1_all.deb
sudo dpkg -i rabbitmq-server_3.7.17-1_all.deb
rm rabbitmq-server_3.7.17-1_all.deb

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


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

sudo netstat -lnp

ReferenceURL : https://stackoverflow.com/questions/14659335/rabbitmq-server-fails-to-start-after-hostname-has-changed-for-first-time

반응형