1

I want to create a three node RabbitMQ cluster on a single RHEL8 machine for testing purposes. I tried instructions given in RabbitMQ official guide and also tried to follow this guide. The first node works fine and it's running. However, the second node cannot be started and throws up an error.

I used below commands as mentioned in the guide.

RABBITMQ_NODE_PORT=5672 RABBITMQ_NODENAME=rabbit rabbitmq-server -detached 

RABBITMQ_NODE_PORT=5673 RABBITMQ_NODENAME=hare rabbitmq-server -detached 

rabbitmqctl -n hare stop_app

This command throws up below error.

DIAGNOSTICS

attempted to contact: [hare@localhost]

hare@localhost:

  • connected to epmd (port 4369) on localhost
  • epmd reports: node 'hare' not running at all other nodes on localhost: [rabbit]

On further inspection of logs, it seems like that this node tries to use the same ports used by the first node (e.g. MQTT port 1883).

I think I might have to use the other option of declaring /etc/rabbitmq/rabbitmq.conf. Mainly because it seems to give more options to change ports etc.

A sample config file resembling the one needed in my case or a link to a proper guide is highly appreciated.

dab92
  • 155
  • 8

1 Answers1

0

You didn't specify, but you must have the MQTT plugin enabled for there to be a conflict on that port, correct?

The easiest work-around would be to have two configuration files specifying different ports for MQTT, AMQP and anything else. Then, use the RABBITMQ_CONFIG_FILE environment variable to point to the appropriate file:

RABBITMQ_NODE_PORT=5672 RABBITMQ_NODENAME=rabbit0 \
    RABBITMQ_CONFIG_FILE=/path/to/rabbitmq-0.conf rabbitmq-server -detached

RABBITMQ_NODE_PORT=5673 RABBITMQ_NODENAME=rabbit1 \
    RABBITMQ_CONFIG_FILE=/path/to/rabbitmq-1.conf rabbitmq-server -detached

NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.

Luke Bakken
  • 8,993
  • 2
  • 20
  • 33
  • Thanks for your answer. Yes. you were right. I had enabled MQTT plugin, rabbitmq_management plugin as instructed in the guide I have mentioned. I disabled all those and started everything again and it worked. Actually I didn't create separate configuration files, but used commands I have mentioned earlier. However only 'rabbit' node is up after a restart and other two nodes in the cluster aren't running. What would be the best option to keep all nodes running after a restart? – dab92 Apr 22 '22 at 05:54
  • Running a cluster on a single machine is only useful for development. In production, you should be using separate servers that run the official packages and are managed my systemd or your system's init. – Luke Bakken Apr 22 '22 at 21:35
  • Yes. I was using this for testing only. But as I had to turnoff my machine sometimes, I wanted to see if each node could be managed by a separate systemd instance. But I got the point you've made. Thanks! – dab92 Apr 25 '22 at 03:29