[rabbitmq-discuss] hostname change

Dushin Fred fred at dushin.net
Wed Feb 6 12:28:26 GMT 2013


Thanks for that, Matthias,

I have conformed that I can set the full node name using the RABBITMQ_NODENAME environment variable and an explicit machine name in the @ part of the expression, e.g.,

RABBITMQ_NODENAME=bunny at localhost

and the broker is now resilient to hostname changes.  (I suspect I will not be able to easily cluster it as a result, but that is a separate topic).

I went back and looked over the docs and thought of suggesting some clarifying remarks, but in retrospect they are probably clear enough.  I think I was thrown off by the example at [1], where the NODENAME is set to "bunny".

As usual, thank you for your timely and dependable response.

-Fred

[1] http://www.rabbitmq.com/configure.html

On Feb 1, 2013, at 5:44 AM, Matthias Radestock <matthias at rabbitmq.com> wrote:

> Fred,
> 
> On 29/01/13 19:56, Dushin Fred wrote:
>> I am using the RABBITMQ_NODENAME environment variable, but that
>> appears to only set the first part of the node name.
> 
> RABBITMQ_NODENAME can contain the full node name, and indeed generally should since otherwise...
> 
>> The directory name (under ${RABBITMQ_MNESIA_BASE}) does not contain
>> the @$HOSTNAME suffix, but if I do a recursive grep through the
>> directory, I still find artifacts with my previous host name.
> 
> ...which is bad since a change in hostname would result in rabbit attempting to work with an mnesia db that is tied to a different node (i.e. containing the old hostname).
> 
>> And a hostname reset (and
>> reboot) results in a fresh DB, even if I start the broker by
>> explicitly setting HOSTNAME to the previous value.
> 
> That is odd. The startup scripts construct the node name from $HOSTNAME if the latter is set. See http://hg.rabbitmq.com/rabbitmq-server/file/fefbea5d28eb/scripts/rabbitmq-env#l37. And provided you haven't also set RABBITMQ_NODENAME, which would override that setting.
> 
> And a quick experiment confirms that is working as expected.
> 
> Note though that $HOSTNAME must be resolvable, or you'll see something like
> 
> ERROR: epmd error for host "oldhost": nxdomain (non-existing domain)
> 
> on startup.
> 
> 
> Regards,
> 
> Matthias.



More information about the rabbitmq-discuss mailing list