[rabbitmq-discuss] Configuring RabbitMQ to support change in hostname

Tim Watson tim at rabbitmq.com
Wed Apr 3 10:48:21 BST 2013


Hi

On 2 Apr 2013, at 20:29, Kapil Goyal wrote:

> I noticed that names of log files, DB etc. are created from node-name. Node-name itself is created based on hostname by default. So, if hostname changes, node-names changes and so do the DB, logs etc.

I can see why this is a source of difficulty if your hostname changes with regularly, but surely the better solution would be to find some way to prevent the hostname from changing?

>  
> My idea was to fix the node-name and make it independent of the hostname, thus fixing the names of DB and logs. But, if I try to use a clustered or federated setup, the multiple RabbitMQ instances will need to talk to each other and I cannot use the same fixed node-name for all the instances. To solve that, I thought I will generate the node-name at first boot of the RabbitMQ server (and not change it ever). Random-string was just to ensure that all RabbitMQ instances get unique node-names.

I understand that, but it will not work. The node name has to be a valid Erlang node name, and that has the form <name>@<host> where the <host> part can be either a fully qualified domain name or a short name such as 'myhost'. You cannot use 'rabbit at 987sdfkjhisd7f7d87sdf' to connect to other Erlang nodes unless the part after the @ is actually the hostname. In addition to this, mnesia - Erlang's distributed database - insists on creating its on-disk schema in a folder which is named Mnesia.<node-name>, and we have no control over that. Renaming the mnesia directory is fine in principle, although if you change the node's name when you're in a cluster then there's a bigger problem because you'll have to notify all the other member nodes that you're changing name - I think the only way to do that would be to leave the cluster and then come back as another node. 

>  
> From: rabbitmq-discuss-bounces at lists.rabbitmq.com [mailto:rabbitmq-discuss-bounces at lists.rabbitmq.com] On Behalf Of Tim Watson
> Sent: Tuesday, April 02, 2013 11:59 AM
> To: Discussions about RabbitMQ
> Cc: Discussions about RabbitMQ
> Subject: Re: [rabbitmq-discuss] Configuring RabbitMQ to support change in hostname
>  
> Hi
> 
> On 2 Apr 2013, at 19:44, Kapil Goyal <goyalk at vmware.com> wrote:
> 
> So, RabbitMQ does not really support change in hostname at all without losing existing data. Is that correct?
>  
>  
> Erm not quite - if you copy/rename the mnesia directory you can work around this. The node name is dev1 then you can rename/move directories to something else (or override directory names to use something that isn't bound to the node name if you prefer). I don't see how your proposed use of a
> Random stein would make any different though. 
> 
> 
> From: rabbitmq-discuss-bounces at lists.rabbitmq.com [mailto:rabbitmq-discuss-bounces at lists.rabbitmq.com] On Behalf Of Tim Watson
> Sent: Tuesday, April 02, 2013 4:31 AM
> To: Discussions about RabbitMQ
> Cc: Discussions about RabbitMQ
> Subject: Re: [rabbitmq-discuss] Configuring RabbitMQ to support change in hostname
>  
> On 29 Mar 2013, at 23:18, Kapil Goyal <goyalk at vmware.com> wrote:
>  
>  am thinking of solving it by replacing rabbit at localhost with rabbit@<random string> before RabbitMQ starts for the first time. Does <random string> have to be DNS resolvable?
>  
> Yes. It needs to be the proper hostname for the node.
>  
> 
> 
> 
>  
>  
> From: rabbitmq-discuss-bounces at lists.rabbitmq.com [mailto:rabbitmq-discuss-bounces at lists.rabbitmq.com] On Behalf Of Dushin Fred
> Sent: Thursday, March 28, 2013 6:44 PM
> To: Discussions about RabbitMQ
> Subject: Re: [rabbitmq-discuss] Configuring RabbitMQ to support change in hostname
>  
> See
>  
> http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2013-February/025368.html
>  
>  
> On Mar 28, 2013, at 4:53 PM, Kapil Goyal <goyalk at vmware.com> wrote:
> 
> 
> 
> 
> RabbitMQ creates a new database if hostname is changed (as documented at http://www.rabbitmq.com/ec2.html).
>  
> I need to support the hostname change on my RabbitMQ server without impacting its functioning. Can I accomplish this by setting the NODENAME environment variable in rabbitmq-env.conf. It seems from rabbitmq-server script that names of database, logs etc. try to use this variable before resorting to using hostname. Is this the right approach? Are there any side-effects to look out for?
>  
> Thanks
> Kapil Goyal
> Sr. MTS
> VMware Inc.
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>  
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130403/05fe44b6/attachment.htm>


More information about the rabbitmq-discuss mailing list