首页 > 解决方案 > WARN: 网络上有多个服务器广播相同的节点 ID

问题描述

我有一个在不同机器上运行的由三个 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

这是硕士的片段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>

这是其中一个奴隶的片段broker.xml

<connectors>
   <connector name="nettyartemistwo">tcp://10.5.100.2:61616</connector>
</connectors>

<discovery-groups>
   <discovery-group name="my-discovery-group">
      <local-bind-address>10.5.100.2</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>nettyartemistwo</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.2</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>nettyartemistwo</connector-ref>
   </broadcast-group>
</broadcast-groups>

<ha-policy>
   <replication>
      <slave/>
   </replication>
</ha-policy>

任何想法建议为什么我会收到此警告?

标签: jmsactivemq-artemis

解决方案


当代理实例首次启动时,它会初始化其日志。代理在此初始化阶段所做的一件事是生成一个 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。


推荐阅读