[rabbitmq-discuss] Cannot start cluster?

Simon MacMullen simon at rabbitmq.com
Sat Jan 15 11:41:47 GMT 2011


On 14/01/2011 7:38PM, Brian Parkinson wrote:
> Hello - starting to play with clustering - I am using Rabbit 2.2.0 on
> Mac.
>
> Running one server (either by 'rabbit-server' or 'rabbit-multi
> start_all 1') works fine. Trying to start a cluster with 2 nodes
> fails - see output below.
>
> 1. Any ideas?

Hi Brian. If I had to guess I would say this is because you've got the 
management plugin installed. rabbitmq-multi assigns sequential AMQP 
listening ports for the nodes it starts, but it doesn't know anything 
about the port opened by rabbitmq_mochiweb (or any other ports the nodes 
might be configured to open - SSL, STOMP etc).

I think you'll want to start the nodes without using rabbitmq-multi, 
just with multiple invocations of rabbitmq-server, using environment 
variables to configure each node differently. I use a script like:

start-node.sh:
~~~~
#!/bin/sh
RABBITMQ_NODE_PORT=$1 RABBITMQ_NODENAME=$2 \
RABBITMQ_MNESIA_DIR=/tmp/rabbitmq-$2-mnesia \
RABBITMQ_PLUGINS_EXPAND_DIR=/tmp/rabbitmq-$2-plugins-scratch \
RABBITMQ_LOG_BASE=/tmp \
RABBITMQ_SERVER_START_ARGS="-rabbit_mochiweb port 5$1" \
/path/to/rabbitmq-server
~~~~

and then invoke it as

start-node.sh 5672 rabbit
start-node.sh 5673 hare

etc. Note that this will start RabbitMQ in the foreground.

Note that neither rabbitmq-multi nor this approach will actually cluster 
the nodes; you'll need something like:

rabbitmqctl stop_app
rabbitmqctl reset
rabbitmqctl cluster rabbit at hostname hare at hostname
rabbitmqctl start_app

to form a cluster.

> 2. A quick question/confirmation about a cluster. Assume I have a
2-node cluster running, and my client app connects via a
ConnectionFactory pointing at host/port of node1. If node1 then goes
down, will my client app continue to talk to node2?

No, I'm afraid you need to handle reconnection yourself.

Cheers, Simon


More information about the rabbitmq-discuss mailing list