[rabbitmq-discuss] use rabbit.config file to start multiple nodes

Jason Klassen Jason.Klassen at protegra.com
Thu Jun 16 16:47:38 BST 2011

Hi Simon,

Thanks for the insight.  Looks like it's Plan B then.  I modified the rabbitmq-server.bat and created rabbitmq-multi-server.bat to take parameters of nodename and port.   It would be handy to have future batch files include the ability to use named parameters instead of relying on environment variables. so we can do:

...\sbin>rabbitmq-server -port=5555 -sname=testRabbit -startargs='-rabbitmq_mochiweb port 55555'

With this in place I can now start 2 servers by calling

...\sbin> rabbitmq-multi-server rabbit1 4444
...\sbin> rabbitmq-multi-server rabbit2 5555

Not the most flexible but it works.  In case it's of use to anyone else the contents are below. Replace setlocal enabledelayedexpansion  with the below snippet in rabbitmq-server 

setlocal enabledelayedexpansion 

rem ************
rem hacking around config
rem ************

set USER_NODENAME=rabbit
if not "%1"=="" (
    set USER_NODENAME=%1

set USER_PORT=5672
if not "%2"=="" (
    set USER_PORT=%2

if "!RABBITMQ_BASE!"=="" (

if "!COMPUTERNAME!"=="" (
    set COMPUTERNAME=localhost



rem ************
rem end of hacking around config
rem ************

Note: if you run the rabbitMQ management plugin you'll need some additional handling to prevent conflicts with multiple launches of that as well.


-----Original Message-----
From: rabbitmq-discuss-bounces at lists.rabbitmq.com [mailto:rabbitmq-discuss-bounces at lists.rabbitmq.com] On Behalf Of Simon MacMullen
Sent: June-16-11 5:14 AM
To: rabbitmq-discuss at lists.rabbitmq.com
Subject: Re: [rabbitmq-discuss] use rabbit.config file to start multiple nodes

On 15/06/11 22:51, Jason Klassen wrote:
> How do I set the nodename through the config file?

I'm afraid you can't do that. (Boring reason why: the nodename is set as the process starts up, before we read the config file.)

> How can I set 2 nodes in a single config file?

...and you also can't do that.

> I am trying to avoid setting environment variables as this solution 
> should be easily run by other developers and a config file removes the 
> chance of typos.

That makes sense. In future we might move to preprocessing the config file somehow so that nodename can be set that way.

Probably your best bet is to write a script to start nodes in the way you want.

Cheers, Simon

Simon MacMullen
RabbitMQ, VMware
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com

More information about the rabbitmq-discuss mailing list