首页 > 解决方案 > Rabbit MQ 声明式集群

问题描述

我有一个在 Windows 2012 服务器 (rabbit@my-server-1) 上运行的 RabbitMQ 节点。

我正在单独的服务器(也是 Windows 2012)上创建第二个节点(rabbit@my-server-2),并希望将其与现有节点集群。第二个节点的部署是通过 Octopus Deploy 进行的,为了让生活更轻松,我希望在节点启动时自动完成集群。

阅读文档(https://www.rabbitmq.com/clustering.htmlhttps://www.rabbitmq.com/configure.html)让我相信我只需将以下内容添加到 rabbitmq.conf 文件中:

cluster_nodes.disc.1 = rabbit@my-server-1

但是,这样做会导致节点无法启动。erl.exe 进程开始使用 100% cpu,我在 erl_crash.dump 文件中看到以下消息:

Slogan: init terminating in do_boot (generate_config_file)

我相信这是无效配置文件的症状,确实删除这些配置条目可以让我正常启动节点。

我可以通过相关的 rabbitmqctl 命令手动集群到现有节点,但如果可能的话,我更喜欢声明性解决方案。

我正在运行 RabbitMQ v3.7.4 和 Erlang v20.3

那么,我做错了什么?我做了一些谷歌搜索,但没有找到任何帮助。

编辑

完整的配置文件是:

listeners.ssl.default = 5671

ssl_options.cacertfile = e:/Rabbit/Certificates/cacert.pem
ssl_options.certfile = e:/Rabbit/Certificates/cert.pem
ssl_options.keyfile = e:/Rabbit/Certificates/key.pem
ssl_options.password = xxxxxxx
ssl_options.verify = verify_none
ssl_options.fail_if_no_peer_cert = false
ssl_options.versions.1 = tlsv1.2

web_stomp.ssl.port       = 14879
web_stomp.ssl.backlog    = 1024
web_stomp.ssl.certfile   = e:/Rabbit/Certificates/cert.pem
web_stomp.ssl.keyfile    = e:/Rabbit/Certificates/key.pem
web_stomp.ssl.cacertfile = e:/Rabbit/Certificates/cacert.pem
web_stomp.ssl.password   = xxxxxxx

cluster_nodes.disc.1 = rabbit@my-server-1

标签: rabbitmq

解决方案


如何添加集群信息,如“配置文件对等发现后端”下的文档中所写

这会给你留下一个像这样的配置文件:

listeners.ssl.default = 5671

ssl_options.cacertfile = e:/Rabbit/Certificates/cacert.pem
ssl_options.certfile = e:/Rabbit/Certificates/cert.pem
ssl_options.keyfile = e:/Rabbit/Certificates/key.pem
ssl_options.password = xxxxxxx
ssl_options.verify = verify_none
ssl_options.fail_if_no_peer_cert = false
ssl_options.versions.1 = tlsv1.2

web_stomp.ssl.port       = 14879
web_stomp.ssl.backlog    = 1024
web_stomp.ssl.certfile   = e:/Rabbit/Certificates/cert.pem
web_stomp.ssl.keyfile    = e:/Rabbit/Certificates/key.pem
web_stomp.ssl.cacertfile = e:/Rabbit/Certificates/cacert.pem
web_stomp.ssl.password   = xxxxxxx

cluster_formation.peer_discovery_backend = rabbit_peer_discovery_classic_config
cluster_formation.classic_config.nodes.1 = rabbit@my-server-1
cluster_formation.classic_config.nodes.2 = rabbit@my-server-2

推荐阅读