[rabbitmq-discuss] nodename variable and mnesia directory

Elizabeth Liao eliao at seegrid.com
Fri Oct 19 19:44:26 BST 2012


Hi Tim,

I'm going to back up a bit because it seems that I've misunderstood something previously.

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

I had an earlier problem changing the hostname and restarting the rabbitmq-server. The proposed fix was to add the NODENAME variable which I'm guessing was not right? :
http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2012-July/021435.html

>Can you explain a bit more about this 'bug' please? What exactly is
going wrong?

The bug is on our end where the NODENAME is set to an empty string. Of course this is moot if NODENAME doesn't even have to be set in the first place.

Liz
________________________________________
From: Tim Watson [tim at rabbitmq.com]
Sent: Friday, October 19, 2012 12:48 PM
To: Discussions about RabbitMQ
Cc: Elizabeth Liao
Subject: Re: [rabbitmq-discuss] nodename variable and mnesia directory

Hi

On 10/19/2012 03:41 PM, Elizabeth Liao wrote:
> Hi,
>
> 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
going wrong?

> 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
you.

> We are running rabbitmq-server-2.8.6 and erlang-R15B.
>
> Thanks!

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
RABBITMQ_LOG_BASE="/tmp"
RABBITMQ_MNESIA_DIR="/tmp/rabbitmq-rabbit-mnesia"
RABBITMQ_PID_FILE="/tmp/rabbitmq-rabbit.pid"
RABBITMQ_PLUGINS_EXPAND_DIR="/tmp/rabbitmq-rabbit-plugins-scratch"
RABBITMQ_ENABLED_PLUGINS_FILE="/tmp/enabled-plugins"
RABBITMQ_CONFIG_FILE="/tmp/etc/rabbit" ./scripts/rabbitmq-server

Then change the hostname, then stop rabbit and start it again,
everything is fine.

Cheers,
Tim

> Liz
> 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
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

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.


More information about the rabbitmq-discuss mailing list