[rabbitmq-discuss] nodename variable and mnesia directory
tim at rabbitmq.com
Fri Oct 19 17:42:55 BST 2012
On 10/19/2012 03:41 PM, Elizabeth Liao wrote:
> We are currently running rabbitmq on a system where there is a need to change the hostname occasionally. Right now, when the hostname is changed, we also update the NODENAME variable in the rabbitmq-env.conf file.
The first thing I'm going to say is that this isn't really a desirable
state of affairs. Why do you need to change NODENAME at all, just
because the host name has changed? This seems like an odd step to me -
can you explain the rationale behind it?
> The problem we're having right now is that due to a bug when setting up the rabbitmq-env.conf file, sometimes the NODENAME variable exists but is not set to anything ( NODENAME=) so rabbit never successfully starts up. Even after setting the NODENAME variable to the hostname, rabbit still doesn't start up properly.
Can you explain a bit more about this 'bug' please? What exactly is
> The only way that I could find to recover from this situation without killing the erlang process, was to also set a MNESIA_DIR variable. After I did that, once the NODENAME was set to the correct hostname, rabbit started up properly.
Now this makes no sense at all to me. If you are trying to recover
'without killing the erlang process' then how are you planning on
changing the NODENAME? Once an erlang node has become part of a
distributed system, you cannot arbitrarily change the node's name
without restarting the net_kernel AFAIK so I can't see how this is even
possible. Also, because you're stating that 'rabbit started up properly'
I'm assuming that you have in fact taken the node offline (using
`rabbitmqctl stop` or one of the various service scripts that invokes
it) and that you are now starting the node again. The rabbit startup
scripts (and associated infrastructure) is not set up to handle changing
the name of a node post-installation in this manner, so I would not
expect this to work smoothly.
> A couple of questions:
> Is this the proper way to fix the situation?
No. As I said a moment ago, rabbit is not set up for this kind of
scenario so I'd be very cautious about doing this and would really
recommend against it.
> Will this have unintended consequences?
I have no idea, but it is entirely possible that various things could
break in obscure and alarming ways. I really would not do this if I were
> We are running rabbitmq-server-2.8.6 and erlang-R15B.
Liz. I would like to help you find a safe work-around so that you can
use rabbit in your environment. I would really like to understand why
the changing of a machine's host-name is causing problems for you. I
fully realise that after changing the hostname, it is possible that a
restart may be required (although I'd have to do some research to verify
whether or not this is a hard requirement). But I cannot understand why
a change to the machine's host name requires changing the rabbit
NODENAME at all, unless you've altered the rabbit start scripts to use
'longnames' configuration (i.e., including the complete host name in the
node name) in which case, a simple solution to your problem might be to
switch back to using 'shortnames'. If erlang is started using -sname
rabbit@`hostname -s` and your /etc/hosts configuration supports
resolving the machine's IP to the short version of the name, then
changing the hostname shouldn't cause all of these headaches.
For example, if I launch rabbit with something like this:
env RABBITMQ_NODENAME=rabbit RABBITMQ_NODE_PORT=5672
Then change the hostname, then stop rabbit and start it again,
everything is fine.
> Email Confidentiality Notice
> The information contained in this transmission is confidential, proprietary or privileged and may be subject to protection under the law. This message is intended for the sole use of the individual or entity to whom it's addressed. If you are not the intended recipient, you are notified that any use, distribution or copying of the message is strictly prohibited and may subject you to criminal or civil penalties. If you received this transmission in error, please contact the sender immediately by replying to this email and delete the material from any computer.
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
More information about the rabbitmq-discuss