rabbitmq - cluster_formation.classic_config.nodes 不适用于rabbitmq

标签 rabbitmq config

我有 2 个 rabbitmq 节点。
它们的节点名称是:rabbit@testhost1 和 rabbit@testhost2
我希望他们可以自动集群。

在 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

在 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

我先启动rabbit@testhost1,然后是rabbit@testhost2。

第二个节点没有加入第一个节点的集群。

而节点rabbit@testhost1 可以通过rabbitmqctl 命令加入rabbit@testhost2:rabbitmqctl join_cluster rabbit@testhost2。
所以之间的网络应该没有问题。

你能给我一些关于为什么不能组合集群的想法吗?配置也不对?

我打开了调试日志,rabbit_peer_discovery_classic_config 相关的信息很少:
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.

rabbitmq 版本是 3.7.8

最佳答案

在尝试集群之前,您是否在没有集群配置的情况下启动了节点?

在将集群形成设置添加到配置文件之前,我已经使用默认配置启动了单个对等点。通过在没有集群配置的情况下启动一个节点,它似乎形成了一个自己的集群,并且在进一步启动时只会联系最后一个已知集群(自己)。

来自 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.



您应该可以使用 rabbitmqctl reset 重置节点(警告:这会从管理数据库中删除所有数据,例如配置的用户和虚拟主机,并删除所有持久消息以及集群信息。)然后使用集群配置。

关于rabbitmq - cluster_formation.classic_config.nodes 不适用于rabbitmq,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54415788/

相关文章:

.net - RabbitMQ 消费者作为 Windows 服务

linux - 在 RabbitMQ 崩溃后有没有办法拯救队列?

rabbitmq 和 logstash 配置不工作

laravel - 在 laravel 5 中使用包的配置文件

emacs - emacs 更好的默认设置

javascript - 多级静态路由架构React Router v4

symfony - MonologBu​​ndle 内存泄漏(?)

.net - 如何检查RabbitMQ消息队列是否存在?

netbeans - 以编程方式更改 Netbeans 内部的颜色?

html - Nginx 服务器不从骨架框架加载 css 文件