[rabbitmq-discuss] nodename variable and mnesia directory

Tim Watson watson.timothy at gmail.com
Wed Oct 24 22:37:07 BST 2012


Hi Liz

On 24 Oct 2012, at 22:06, Elizabeth Liao <eliao at seegrid.com> wrote:

> I confirmed that when I run the sequence of commands and then log out and log back in, the rabbitmq server seems to start up fine.  However, these commands are run in a script so I didn't want to have to re-login to startup the rabbitmq server.
> 
> After trying various things, it seems that rabbit is using the HOSTNAME environment variable and I needed to set that for it to work. So running the following commands appeared to work:
> 
> * /etc/init.d/rabbitmq-server stop
> * In /etc/hosts changed line from 127.0.1.1 <oldhostname> <oldhostname>.localdomain -> 127.0.1.1 <newhostname> <newhostname>.localdomain
> * in /etc/sysconfig/network changed HOSTNAME=<oldhostname> -> HOSTNAME=<newhostname>
> * /bin/hostname <newhostname>
> * export HOSTNAME=<newhostname>
> * /etc/init.d/rabbitmq-server start
> 
> Can you confirm this on your system as well?  Is there an added benefit of also running rabbitmqctl stop and epmd -kill?
> 

Yes that appears to work for me in a vm. If stopping and restarting epmd is not necessary then I would just avoid doing it if I were you.

> Thanks.
> 
> Liz
> ________________________________________
> From: Tim Watson [watson.timothy at gmail.com]
> Sent: Tuesday, October 23, 2012 4:33 AM
> To: Elizabeth Liao
> Cc: Discussions about RabbitMQ
> Subject: Re: [rabbitmq-discuss] nodename variable and mnesia directory
> 
> Hi
> 
> On 22 Oct 2012, at 23:14, Elizabeth Liao <eliao at seegrid.com> wrote:
> 
>> Hi,
>> 
>> This is what I tried
>> * I start running rabbit with no NODENAME set and entered the following commands
>> * rabbitmqctl stop
>> * /etc/init.d/rabbitmq-server stop
>> * epmd -kill ( Is this correct? I didn't see a restart in the documentation )
> 
> That is correct.
> 
>> * In /etc/hosts changed line from 127.0.1.1 <oldhostname> <oldhostname>.localdomain -> 127.0.1.1 <newhostname> <newhostname>.localdomain
>> * in /etc/sysconfig/network changed HOSTNAME=<oldhostname> -> HOSTNAME=<newhostname>
>> * /bin/hostname <newhostname>
> 
> At this point I found I needed to log out and back in again, though that was on centos an I'm not sure it's necessary to restart a profile on all operating systems. What os are you running an what does the documentation state about hostname changes? Do you, for example, have to restart the os networking sub system?
> 
>> * /etc/init.d/rabbitmq-server start
>> 
>> The error I get is this:
>> Activating RabbitMQ plugins ...
>> 3 plugins activated:
>> * amqp_client-2.8.6
>> * erlando-2.8.6
>> * rabbitmq_shovel-2.8.6
>> 
>> ERROR: epmd error for host "<oldhostname>": nxdomain (non-existing domain)
>> 
>> 
>> 
>> ________________________________________
>> From: Tim Watson [tim at rabbitmq.com]
>> Sent: Monday, October 22, 2012 6:41 AM
>> To: Discussions about RabbitMQ
>> Cc: Elizabeth Liao
>> Subject: Re: [rabbitmq-discuss] nodename variable and mnesia directory
>> 
>> Hi again,
>> 
>> On 20 Oct 2012, at 10:52, Tim Watson wrote:
>> 
>>> Hi Liz,
>>> 
>>> Sorry i wasn't aware of the context. What Ian recommended should not be necessary, though I'll follow up with him on Monday to try and figure out why he needed to do that.
>>> 
>>> Once you change the hostname you,ll possibly need to restart epmd and restart your rabbit, but you shouldn't need to change the node name from say rabbit to hare.
>>> 
>> 
>> Were you able to try this again (changing only the host name but not the node name) and did it work for you? If not I'd like to know so we can investigate.
>> 
>> Cheers
>> Tim
>> 
>>> Cheers
>>> Tim
>>> 
>>> 
>>> 
>>> On 19 Oct 2012, at 19:44, Elizabeth Liao <eliao at seegrid.com> wrote:
>>> 
>>>> 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.
>>> _______________________________________________
>>> 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.
> 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