개발.log/rabbitMQ

[RabbitMQ] Window/rabbitmq-server 서버가 실행 중인지 확인하기/ Error: unable to connect to node rabbit@localhost: nodedown

개발하는 주디씨 2023. 4. 18. 14:22

 

Error: unable to connect to node rabbit@localhost: nodedown

 

rabbitMq는 분산 메시징 시스템으로서 주로 서버를 구축하는 리눅스나 클라우드 환경에 설치하게 된다. 하지만 어쩌다보니 Window 환경에서 사용하게 되었다. 많은 사람들이 Window에서는 잘 사용하지 않다보니 자료도 별로 없어 꽤 고생했었다. 따라서 Window 에서 RabbitMq를 설치하며 삽질했던 과정을 포스팅하려고 한다.

 

rabbitmq-server 명령어가 실행되지 않고 이상한 에러메시지가 출력된다면 rabbitmq 서버가 실행되고 있는 지 확인해야 한다. 이때, 서버 실행과 localhost manager UI화면과는 별개이다. 서버가 실행되지 않아도 manager UI는 접근이 되기 때문에 혼돈해선 안된다.

rabbitmqctl status

 

위 명령을 실행하면 RabbitMQ 서버의 상태 정보를 확인할 수 있다. 만약 RabbitMQ 서버가 실행되고 있다면, Status가 로그형태로 출력된다. 만약 서버가 실행되고 있지 않다면, Failed to connect to broker와 같은 에러 메시지가 출력된다.

 

rabbitMq server가 실행중일 때 log

 

*RabbitMq 서버가 실행 중일 때, 성공 메시지

Status of node rabbit@localhost ...
[{pid,21654},
 {running_applications,[{rabbit,"RabbitMQ","3.8.14"},
                        {os_mon,"CPO  CXC 138 46","2.5.1"},
                        {rabbit_common,[],"3.8.14"},
                        {xmerl,"XML parser","1.3.18"},
                        {crypto,"CRYPTO","4.8.2"},
                        {ssl,"Erlang/OTP SSL application","10.6.2"},
                        {public_key,"Public key infrastructure","1.10.4"},
                        {asn1,"The Erlang ASN1 compiler version 5.0.9","5.0.9"},
                        {sasl,"SASL  CXC 138 11","3.4.4"},
                        {stdlib,"ERTS  CXC 138 10","3.15.1"},
                        {kernel,"ERTS  CXC 138 10","7.0.1"}]},
 {os,{unix,linux}},
 {erlang_version,"22.3.4.18"},
 {memory,[{total,71228208},
          {connection_readers,0},
          {connection_writers,0},
          {connection_channels,0},
          {connection_other,0},
          {queue_procs,0},
          {queue_slave_procs,0},
          {plugins,0},
          {other_proc,629848},
          {mnesia,13584},
          {mgmt_db,0},
          {msg_index,0},
          {other_ets,811080},
          {binary,17280},
          {code,29853798},
          {atom,805929},
          {other_system,13736397}]},
 {alarms,[]},
 {listeners,[{clustering,25672,"::"},{amqp,5672,"::"}]},
 {vm_memory_high_watermark,0.4},
 {vm_memory_limit,6665370828},
 {disk_free_limit,50000000},
 {disk_free,65297798144},
 {file_descriptors,[{total_limit,1048576},
                     {total_used,17},
                     {sockets_limit,943626},
                     {sockets_used,15}]},
 {processes,[{limit,1048576},{used,259}]},
 {run_queue,0},
 {uptime,3}]

 

* RabbitMq 서버가 실행 중이 아닐 때, 에러 메시지

Error: unable to connect to node rabbit@localhost: nodedown

DIAGNOSTICS
===========
- nodes and their ports on localhost: []
- current node: rabbitmq-cli-3.8.14
- current node home dir: /usr/local/Cellar/rabbitmq/3.8.14_1/lib/rabbitmq
- current node cookie hash: R9E9jKsw/57OEM01IOTgOA==

성공 메시지를 받았다면 서버가 실행 중이라는 뜻이지만 에러 메시지를 받은 경우, 아래 명령어를 입력하여 RabbitMQ 서버를 실행해주어야 한다.

rabbitmq-server start

 

이렇게 했는데도 서버가 실행되었다는 로그 메시지 없이 Warning 만 나오는 경우가 있다.. 이걸로 이틀을 삽질 한 것 같다.

RabbitMQ 서버가 실행되지 않고 경고 메시지만 나타나는 경우, 일반적으로 환경 변수가 제대로 설정되지 않았거나 Erlang cookie가 일치하지 않는 경우이다. 환경 변수가 제대로 설정되어 있는지 확인하고 Erlang cookie가 일치하는지 확인해봐야 한다.

 

하지만 근본적으로 Erlnag cookie를 직접 손댈 일은 거의 없다. 이 경우 Erlang 버전과 RabbitMq 버전이 호환되지 않아 cookie를 못찾는 경우이다. 따라서 버전을 확인하고 재설치하면 해결될 가능성이 높다.