Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cluster_formation.classic_config.nodes does not work of rabbitmq

I have 2 rabbitmq nodes. Their node names are: rabbit@testhost1 and rabbit@testhost2 I'd like them can auto cluster.

On testhost1

# cat /etc/rabbitmq/rabbitmq.conf
cluster_formation.peer_discovery_backend = rabbit_peer_discovery_classic_config
cluster_formation.classic_config.nodes.1 = rabbit@testhost1
cluster_formation.classic_config.nodes.2 = rabbit@testhost2

On testhost2

# cat /etc/rabbitmq/rabbitmq.conf
cluster_formation.peer_discovery_backend = rabbit_peer_discovery_classic_config
cluster_formation.classic_config.nodes.1 = rabbit@testhost1
cluster_formation.classic_config.nodes.2 = rabbit@testhost2

I start rabbit@testhost1 first and then rabbit@testhost2.

The second node didn't join to the cluster of first node.

While node rabbit@testhost1 can join rabbit@testhost2 with rabbitmqctl command: rabbitmqctl join_cluster rabbit@testhost2. So the network between should not have problem.

Could you give me some idea about why can't combine cluster? Is the configuration nor correct?

I have opened the debug log and the info related to rabbit_peer_discovery_classic_config is very little:

2019-01-28 16:56:47.913 [info] <0.250.0> Peer discovery backend rabbit_peer_discovery_classic_config does not support registration, skipping registration.

The rabbitmq version is 3.7.8

like image 292
Haiyan GU Avatar asked Jan 29 '19 07:01

Haiyan GU


People also ask

Does RabbitMQ support clustering?

RabbitMQ supports: clustering of multiple nodes. synchronous replication - replicated queues. asynchronous cluster-to-cluster message routing - exchange federation and shovels.

How many nodes are in RabbitMQ cluster?

In a cluster of seven nodes, five nodes will have one replica each but two nodes won't host any replicas. After declaration a quorum queue can be bound to any exchange just as any other RabbitMQ queue.


1 Answers

Did you start the nodes without cluster config before you attempted clustering?

I had started individual peers with the default configuration once before I added cluster formation settings to the config file. By starting a node without clustering config, it seems form a cluster of its own, and on further start would only contact the last known cluster (self).

From https://www.rabbitmq.com/cluster-formation.html

How Peer Discovery Works

When a node starts and detects it doesn't have a previously initialised database, it will check if there's a peer discovery mechanism configured. If that's the case, it will then perform the discovery and attempt to contact each discovered peer in order. Finally, it will attempt to join the cluster of the first reachable peer.

You should be able to reset the node with rabbitmqctl reset (Warning: This removes all data from the management database, such as configured users and vhosts, and deletes all persistent messages along with clustering information.) and then use clustering config.

like image 90
fmb Avatar answered Sep 20 '22 18:09

fmb