Kubernetes ActiveMQ Artemis使用者在崩溃后未重新连接到同一群集节点

Kubernetes ActiveMQ Artemis使用者在崩溃后未重新连接到同一群集节点,kubernetes,spring-jms,activemq-artemis,artemiscloud,Kubernetes,Spring Jms,Activemq Artemis,Artemiscloud,我正在Kubernetes建立一个Artemis集群,其中包含3组主/从设备: activemq-artemis-master-0 1/1 Running activemq-artemis-master-1 1/1 Running activemq-artemis-master-2 1/1 Ru

我正在Kubernetes建立一个Artemis集群,其中包含3组主/从设备:

activemq-artemis-master-0                               1/1     Running
activemq-artemis-master-1                               1/1     Running
activemq-artemis-master-2                               1/1     Running
activemq-artemis-slave-0                                0/1     Running
activemq-artemis-slave-1                                0/1     Running
activemq-artemis-slave-2                                0/1     Running
Artemis版本是2.17.0。这是我在master-0
broker.xml
中的集群配置。其他代理的配置相同,只是
连接器ref
已更改以匹配代理:


activemq-artemis-master-0
真的
异步
数据/分页
数据/绑定
数据/日志
数据/大型消息
真的
2.
10
4096
10米
100000
4096
5000
90
真的
120000
60000
停止
2244000
tcp://0.0.0.0:61616?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;amqpMinLargeMessageSize=102400;协议=核心、AMQP、STOMP、HORNETQ、MQTT、OPENWIRE;useEpoll=true;amqpCredits=1000;amqflowCredits=300;AMQPDicateDetection=true
tcp://0.0.0.0:5672?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;协议=AMQP;useEpoll=true;amqpCredits=1000;amqflowCredits=300;amqpMinLargeMessageSize=102400;AMQPDicateDetection=true
tcp://0.0.0.0:61613?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;协议=跺脚;useEpoll=true
tcp://0.0.0.0:5445?anycastPrefix=jms.queue.;multicastPrefix=jms.topic。;协议=大黄蜂,跺脚;useEpoll=true
tcp://0.0.0.0:1883?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;协议=MQTT;useEpoll=true
DLQ
过期队列
0
-1
10
页
真的
真的
真的
真的
DLQ
过期队列
0
-1
10
页
真的
真的
真的
真的
集群用户
aShortclusterPassword
tcp://activemq-artemis-master-0.activemq-artemis-master.svc.cluster.local:61616
tcp://activemq-artemis-slave-0.activemq-artemis-slave.svc.cluster.local:61616
tcp://activemq-artemis-master-1.activemq-artemis-master.svc.cluster.local:61616
tcp://activemq-artemis-slave-1.activemq-artemis-slave.svc.cluster.local:61616
tcp://activemq-artemis-master-2.activemq-artemis-master.svc.cluster.local:61616
tcp://activemq-artemis-slave-2.activemq-artemis-slave.svc.cluster.local:61616
activemq-artemis-master-0
500
1.1
5000
-1
-1
随需应变
1.
activemq-artemis-master-0
activemq-artemis-slave-0
activemq-artemis-master-1
activemq-artemis-slave-1
activemq-artemis-master-2
activemq-artemis-slave-2
activemq-artemis-0
12
真的
真的
真的
在Spring Boot应用程序中,我的消费者被定义为
JmsListener
。在使用队列中的消息期间,Spring Boot应用程序崩溃,导致kubernetes删除pod并重新创建一个新pod。但是,我注意到新的pod没有连接到同一个Artemis节点,因此以前连接留下的消息从未被使用


我认为使用集群的全部目的是让所有的Artemis节点作为一个单元向消费者传递消息,而不管它连接到哪个节点。我错了吗?如果群集无法将使用者连接重新路由到正确的节点(该节点保存来自前一个使用者的剩余消息),那么建议如何处理这种情况?

首先,需要注意的是,在客户端崩溃/重新启动后,没有使客户端重新连接到其断开连接的代理的功能。一般来说,客户不应该真正关心它连接到哪个经纪人;这是横向可伸缩性的主要目标之一

还值得注意的是,如果代理上的消息数量和连接的客户端数量足够低,以至于这种情况频繁出现,那么几乎可以肯定的是,集群中的代理太多了

也就是说,我认为您的客户机无法获得预期消息的原因是因为您使用了默认的
重新分发延迟(即
-1
),这意味着消息不会重新分发到群集中的其他节点。如果您希望启用重新分发(看起来您是这样做的),则应将其设置为>=0,例如:


除此之外,您可能需要重新考虑总体拓扑结构。通常,如果您处于类似云的环境中(例如,使用Kubernetes的环境),基础设施本身将重新启动失败的POD,那么您不会使用主/从配置。您只需将日志装载到一个单独的pod上(例如,使用NFSv4),这样当节点出现故障时,它将重新启动,然后重新连接到其持久存储。这有效地提供了代理的高可用性(这是主/从服务器在云环境之外设计的)

此外,ActiveMQ Artemis的单个实例可以根据使用情况每秒处理数百万条消息,因此您可能不需要3个活动节点来完成预期负载


注意,这些是关于您的总体架构的一般建议,与您的问题没有直接关系。

感谢您的快速回复Justin,我用配置和版本更新了我的问题。默认地址设置没有更改,我也用f更新了问题