RabbitMQ集群II4

2022-05-03 11:05:57 浏览数 (1)

其它端口也可以手动指定来避免冲突

Note: that if you have RabbitMQ opening any ports other than AMQP, you’ll need to configure those not to clash as well - for example: $ RABBITMQ_NODE_PORT=5672 RABBITMQ_SERVER_START_ARGS=”-rabbitmq_management listener [{port,15672}]” RABBITMQ_NODENAME=rabbit rabbitmq-server -detached $ RABBITMQ_NODE_PORT=5673 RABBITMQ_SERVER_START_ARGS=”-rabbitmq_management listener [{port,15673}]” RABBITMQ_NODENAME=hare rabbitmq-server -detached will start two nodes (which can then be clustered) when the management plugin is installed.


防火墙问题

集群中的node之间可能会有防火墙阻隔,为了确保集群正常工作,node之间必须开放一些端口用于互相通信,打开 436925672

The case for firewalled clustered nodes exists when nodes are in a data center or on a reliable network, but separated by firewalls. Again, clustering is not recommended over a WAN or when network links between nodes are unreliable. In the most common configuration you will need to open ports 4369 and 25672 for clustering to work. Erlang makes use of a Port Mapper Daemon (epmd) for resolution of node names in a cluster. The default epmd port is 4369, but this can be changed using the ERL_EPMD_PORT environment variable. All nodes must use the same port. For further details see the Erlang epmd manpage. Once a distributed Erlang node address has been resolved via epmd, other nodes will attempt to communicate directly with that address using the Erlang distributed node protocol. The default port for this traffic in RabbitMQ is 20000 higher than RABBITMQ_NODE_PORT (i.e. 25672 by default). This can be explicitly configured using the RABBITMQ_DIST_PORT variable - see the configuration guide


集群中Erlang的版本

集群中所有node的Erlang版本必须一致

All nodes in a cluster must run the same version of Erlang.


客户端的连接

集群中没有主备概念,每一个node都是对等的,所以客户端可以连入任意一个node进行操作,如果一个node出现故障,客户端会返回错误,直接连接另一个node就可以继续进行操作

我们可以使用第三方工具确保连接的高可用(如 keepalived)

0 人点赞