Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rabbtimqadmin - Could not connect: [Errno -2] Name or service not known

I have RabbitMQ installed on a CentOS 5.x server which I use for message passing between my programs. I've installed rabbitmqadmin following the directions on https://www.rabbitmq.com/management-cli.html and have used it on my servers in the past.

From what I can tell it looks like this particular server is misconfigured. My web-searches have failed me on trying to get more information on how to troubleshoot this issue.

The error:

[root@server ~]# python26 /usr/local/bin/rabbitmqadmin list nodes
*** Could not connect: [Errno -2] Name or service not known
[root@server ~]# 

I have tried several different rabbitmqadmin commands and they give the same result. If I run the command without the extra params it displays the normal help dialog. I have this setup and working on several other servers.

Any idea on what the root issue is? If not, anyway to get more details, like verbose?

Update:

I just tried to check the version of rabbitmq and its yielding an error too:

[root@server ~]# rabbitmqctl status
Status of node rabbit@server ...
Error: unable to connect to node rabbit@server: nodedown

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

attempted to contact: [rabbit@server]

rabbit@server:
  * connected to epmd (port 4369) on server
  * epmd reports node 'rabbit' running on port 25672
  * TCP connection succeeded but Erlang distribution failed
  * suggestion: hostname mismatch?
  * suggestion: is the cookie set correctly?

current node details:
- node name: rabbitmqctl25451@server
- home dir: /var/lib/rabbitmq
- cookie hash: WXaeZT7XXm13naagfRX5cg==

[root@server ~]# 

I'm going to see if I can find something from this... I find this weird because the server is passing messages fine and can be monitored through the web console.

Erlang version:

[root@server rabbitmq]#  erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().'  -noshell
"R14B04"
[root@server rabbitmq]# 

Rabbitmq Version:

[root@server rabbitmq]# python26 /usr/local/bin/rabbitmqadmin --version
rabbitmqadmin 3.3.5
[root@server rabbitmq]# 
like image 650
James Oravec Avatar asked Apr 07 '15 21:04

James Oravec


1 Answers

After much digging and frustration, I found my problem... I'm posting the solution in case anyone else has a similar experience

Previously, I found that if you setup RabbitMQ on a linux server then change the hostname that it can break some of the rabbit configuration.

The awesome part about this problem is that someone changed the name of the server from all capital letters to lowercase...

I've solve this one of two ways:

Solution 1:

Revert the host name back to the previous name. So that rabbitmq references with the appended server name work again.

Solution 2:

If you want to keep the server name change, then you can create a rabbitmq-env.conf files in /etc/rabbitmq like:

NODENAME=rabbit@OLDHOSTNAME

If you aren't sure what your previous name was, you can reference it by doing an ls in your /var/lib/rabbitmq/mnesia/ folder. You'll then see a folder that matches the nodename you need to specify.

Reference: https://www.rabbitmq.com/man/rabbitmq-env.conf.5.man.html

UPDATE:

Host name is CaSE SeNSiTIve... had someone change a hostname on me and the only difference was the case... so took a while to notice...

like image 87
James Oravec Avatar answered Nov 15 '22 05:11

James Oravec