Kar*_*ran 2 jms activemq-artemis
我有一个由三个 ActiveMQ 代理组成的集群,它们在不同的计算机上运行。现在,我看到一条警告反复说明以下内容
2020-06-17 10:40:07,378 WARN [org.apache.activemq.artemis.core.client] AMQ212034: There are more than one servers on the network broadcasting the same node id. You will see this message exactly once (per node) if a node is restarted, in which case it can be safely ignored. But if it is logged continuously it means you really do have more than one node on the same network active concurrently with the same node id. This could occur if you have a backup node active at the same time as its live node. nodeID=03451127-a9c9-11ea-992a-005056ad92be
Run Code Online (Sandbox Code Playgroud)
这是大师的片段broker.xml:
2020-06-17 10:40:07,378 WARN [org.apache.activemq.artemis.core.client] AMQ212034: There are more than one servers on the network broadcasting the same node id. You will see this message exactly once (per node) if a node is restarted, in which case it can be safely ignored. But if it is logged continuously it means you really do have more than one node on the same network active concurrently with the same node id. This could occur if you have a backup node active at the same time as its live node. nodeID=03451127-a9c9-11ea-992a-005056ad92be
Run Code Online (Sandbox Code Playgroud)
这是其中一个奴隶的片段broker.xml:
<connectors>
<connector name="nettyartemis">tcp://10.5.100.1:61616</connector>
</connectors>
<discovery-groups>
<discovery-group name="my-discovery-group">
<local-bind-address>10.5.100.1</local-bind-address>
<group-address>231.7.7.7</group-address>
<group-port>9876</group-port>
<refresh-timeout>10000</refresh-timeout>
</discovery-group>
</discovery-groups>
<cluster-connections>
<cluster-connection name="my-cluster">
<connector-ref>nettyartemis</connector-ref>
<retry-interval>500</retry-interval>
<use-duplicate-detection>true</use-duplicate-detection>
<message-load-balancing>STRICT</message-load-balancing>
<max-hops>1</max-hops>
<discovery-group-ref discovery-group-name="my-discovery-group"/>
</cluster-connection>
</cluster-connections>
<broadcast-groups>
<broadcast-group name="my-broadcast-group">
<local-bind-address>10.5.100.1</local-bind-address>
<local-bind-port>5432</local-bind-port>
<group-address>231.7.7.7</group-address>
<group-port>9876</group-port>
<broadcast-period>2000</broadcast-period>
<connector-ref>nettyartemis</connector-ref>
</broadcast-group>
</broadcast-groups>
<ha-policy>
<replication>
<master/>
</replication>
</ha-policy>
Run Code Online (Sandbox Code Playgroud)
有什么想法建议我为什么会收到此警告吗?
当代理实例首次启动时,它会初始化其日志。代理在此初始化阶段执行的操作之一是生成一个 UUID,该 UUID 将用于唯一标识代理以进行集群等操作。这称为“节点 ID”。
通常,当用户看到There are more than one servers on the network broadcasting the same node id它时,表明他们已将一个经纪人的日志手动复制到另一个经纪人。这通常是在用户最初配置代理集群时完成的,因为他们想要复制配置而不是在每个节点上从头开始。然而,不仅仅是复制broker.xml到另一个节点,整个日志也会被复制,并且由于日志包含唯一的“节点 ID”,因此两个代理最终都会使用相同的 ID。
这种情况的解决方案是从记录此消息的代理之一中删除日志(data默认存储在该目录中)。一旦代理重新启动,日志将被重新初始化并创建一个新的节点 ID。
WARN如果您配置了 HA 并且主设备和从设备同时处于活动状态,也可能会记录此消息。主服务器和从服务器自然共享相同的节点 ID,因为它们具有相同的日志(通过共享存储或复制)。然而,只有一名经纪人应该是活跃的。如果两个经纪人都活跃,则称为“裂脑”。这种情况可能会产生很大的问题,因为两个经纪商将独立操作相同的日志数据。这可能会导致重复的消息以及看似丢失的消息,并且恢复数据的完整性可能非常困难(如果不是不可能的话)。
在共享存储配置中,共享存储本身可以减轻由于日志上的共享文件锁而导致的脑裂风险。仅允许一名经纪人实际访问日志数据。
然而,在复制配置中,脑裂的风险要高得多,特别是因为主设备和从设备都有自己的数据副本。如果主设备和从设备之间的网络连接失败,那么从设备就没有真正的方法来确定主设备是否真的死亡或者只是网络问题。这就是为什么文档建议使用至少 3 个实时/备份对。这允许建立适当的仲裁,以便活动集群成员可以投票来确定适当的故障转移。
我还发现您尚未对<check-for-live-server>true</check-for-live-server>主代理进行设置,这可能会在发生故障转移并且您重新启动主代理而无需先关闭从属代理的简单情况下导致脑裂。如果没有<check-for-live-server>true</check-for-live-server>主代理,则将简单地启动而不检查另一个代理(例如其备份)是否正在广播其节点 ID。