Running two or more RabbitMQ nodes on single machines.

232 views
Skip to first unread message

meghanand...@games24x7.com

unread,
Jun 19, 2018, 6:11:59 AM6/19/18
to rabbitmq-users
Hi,

We are trying to run two or more completely independent RabbitMQ nodes on the same machine, the only things will be/could be shared will be RabbitMQ binaries (e.g.rabbitmq-server, rabbitmqctl ), we tried to achieve this using environment variables in start up scripts as follows.

Node 1
-----------------
export RABBITMQ_NODE_PORT=5672
export RABBITMQ_NODENAME=rabbit1
export RABBITMQ_SERVER_START_ARGS="-rabbitmq_management listener [{port,15672}]"
export RABBITMQ_LOG_BASE=/var/log/rabbitmq1

Node 2
-----------------
export RABBITMQ_NODE_PORT=5673
export RABBITMQ_NODENAME=rabbit2
export RABBITMQ_SERVER_START_ARGS="-rabbitmq_management listener [{port,15673}]"
export RABBITMQ_LOG_BASE=/var/log/rabbitmq2

The setup is working fine for me.

/usr/sbin/rabbitmqctl -n [node_name] status

I believe even plugins directory can be changed by setting "RABBITMQ_PLUGINS_DIR" - then only resource which is shared between two node is erlang cookie - which resides in /var/lib/rabbitmq/ (I see RABBITMQ_BASE can help me in changing this location - but is available only in Windows).

I've two doubts here.

1. How safe it is to run two nodes of RabbitMQ independently on same server - please note they are not in cluster mode. Each node is going to serve its own requests independently.
2. Is it possible to change location of erlang cookie - if not, is it safe if two nodes (not in cluster) are using same erlang cookie.

It would be really helpful if someone can guide me on this.

Thanks in advance.
- Meghanand

Michael Klishin

unread,
Jun 19, 2018, 7:18:41 AM6/19/18
to rabbitm...@googlegroups.com
There is a transcript that demonstrates that in [1], so it is definitely common
in development environments.

Now to your specific questions.

All nodes in a cluster must use the same cookie [2] regardless of the hosts.
Assuming that two nodes use different data directories, log directories and so on [3]
you can run them but I'd seriously question any benefits of this. You won't be able to
reap any typical benefits associated with clustering [4] by running 2 nodes on the same machine.
In development it is a matter of convenience, production environments have very different needs.


--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
MK

Staff Software Engineer, Pivotal/RabbitMQ

meghanand...@games24x7.com

unread,
Jun 19, 2018, 7:36:53 AM6/19/18
to rabbitmq-users
Hello Michael,

Thanks for your time.
Well as I already said these node won't be in clustering - we want to use each for different purposes & that's why need to completely isolate them from each other.
Just want to know what could be the best possible way to achieve this if we are running them on the same machine.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Michael Klishin

unread,
Jun 19, 2018, 7:52:24 AM6/19/18
to rabbitm...@googlegroups.com
You need to make the nodes use different node names, sets of ports and data/log/etc directories.

Or just run them in separate containers and expose (forward) their ports to the host.


To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages