3

I've got a fresh installation of rabbitmq-server on a Lucid EC2 instance. The hostname is set correctly, but rabbitmq won't pick up the hostname, and insists on calling itself localhost. Any idea how to convince it otherwise?

$ cat /etc/hostname
mifune

$ hostname
mifune

$ cat /etc/hosts
127.0.0.1 localhost mifune
...


$ sudo rabbitmqctl status
Status of node rabbit@localhost ...
[{running_applications,[{rabbit,"RabbitMQ","1.7.2"},
                        {mnesia,"MNESIA  CXC 138 12","4.4.12"},
                        {os_mon,"CPO  CXC 138 46","2.2.4"},
                        {sasl,"SASL  CXC 138 11","2.1.8"},
                        {stdlib,"ERTS  CXC 138 10","1.16.4"},
                        {kernel,"ERTS  CXC 138 10","2.13.4"}]},
 {nodes,[rabbit@localhost]},
 {running_nodes,[rabbit@localhost]}]
...done.
David Eyk
  • 667
  • 1
  • 7
  • 17

1 Answers1

5

Would you believe that switching the order of /etc/hosts/ from:

127.0.0.1 localhost mifune

to:

127.0.0.1 mifune localhost

does the trick?

Make sure you stop rabbitmq before doing this, or rabbitmq will forget who it is and begin wandering around the neighborhood, pestering everybody for directions to the supermarket. It may also go catatonic and need to be completely purged and reinstalled.

David Eyk
  • 667
  • 1
  • 7
  • 17
  • Yes, I would believe this -- it's pretty much standard behaviour across most network-speaking applications. – womble May 11 '12 at 22:36
  • I had assumed that it would believe ```hostname```, but I suppose that doesn't guarantee an addressable name? – David Eyk May 11 '12 at 23:23
  • Indeed; that is precisely why it's done -- because the hostname that someone might specify doesn't exist on the network. If you want the full gory details, `hostname`(1) is full of mind-twisting. – womble May 12 '12 at 00:02
  • I've run into this exact thing before with a custom Erlang application. Being that RMQ is written in Erlang, this makes sense now... – EEAA May 12 '12 at 03:15