0

I'm setting up a RabbitMQ cluster reading from its docs.

While setting it up, it joins Machine2 with Machine1 via command rabbitmqctl join_cluster rabbit@rabbit1. Now what is rabbit@rabbit1?

I know its user@hostname, but when I fire this command, it says Error: {cannot_discover_cluster,"Cannot cluster node with itself"}.

When I type-in the IP instead of hostname, it says Error: {cannot_discover_cluster,"The nodes provided are either offline or not running"}.

I've also added IP rabbit1 in the /etc/hosts file as well.

What exactly am I missing here?

Praful Bagai
  • 16,684
  • 50
  • 136
  • 267

3 Answers3

1

Rabbit@rabbit1,

In this case the rabbit1 is the name of the computer/host where the rabbitmq server is present.

You can just use the name of the server like Rabbit@name_of_the_server where you want to do clustering with.

You can also see what is the name of the current rabbitmq host:

rabbitmqctl cluster_status

That will give you the name I mean host name.

And you need to make sure that before you do clustering you need to stop the rabbitmq server on that machine and then do clustering and then restart the rabbitmq node.

Check this link:

https://www.rabbitmq.com/clustering.html

Mitra Ghorpade
  • 717
  • 4
  • 8
1

"Cannot cluster node with itself" is true. You have to change cluster name for it to join in. Use set_cluster_name to change the cluster name on other nodes first, and then come back to this node and join it to newly named cluster. For example,

On node2,

`rabbitmqctl set_cluster_name rabbit@new`

Back on node1,

`rabbitmqctl stop_app` 
`rabbitmqctl reset`
`rabbitmqctl join_cluster rabbit@new`
`rabbitmqctl start_app`

Quite simple way.

yongsheng
  • 111
  • 3
0

you are trying to join one to itself.

You have two possible errors:

  1. error in /etc/hosts ( wrong alias )
  2. you actual try to join the rabbit@rabbit1 to rabbit@rabbit1
Gabriele Santomaggio
  • 21,656
  • 4
  • 52
  • 52
  • Well, I see only one possibility and that's option one. What could go wrong in `/etc/hosts`. I just added another line in the file of format `1.2.3.4 rabbit`. – Praful Bagai Aug 26 '16 at 19:30