我在使用ActiveMQ Artemis(2.27.1版)时遇到了拓扑问题。我使用3台服务器,每台服务器上有2个节点-主节点和从节点(让我们称它们为A、B、C、A*、B*、C*)。我为每个主节点配置了他的复制,因为从节点位于他旁边(A-
主经纪人. xml
:
<connectors>
<connector name="Master_A">tcp://[HOSTNAME]:[A_MASTER_PORT]</connector>
<connector name="Master_B">tcp://[HOSTNAME]:[B_MASTER_PORT]</connector>
<connector name="Master_C">tcp://[HOSTNAME]:[C_MASTER_PORT]</connector>
<connector name="Slave_B">tcp://[HOSTNAME]:[B_SLAVE_PORT]</connector>
</connectors>
<cluster-connections>
<cluster-connection name="artemis-cluster">
<address></address>
<connector-ref>A_master_connector</connector-ref>
<check-period>30000</check-period>
<connection-ttl>60000</connection-ttl>
<min-large-message-size>102400</min-large-message-size>
<call-timeout>30000</call-timeout>
<retry-interval>500</retry-interval>
<retry-interval-multiplier>1.0</retry-interval-multiplier>
<max-retry-interval>5000</max-retry-interval>
<initial-connect-attempts>-1</initial-connect-attempts>
<reconnect-attempts>-1</reconnect-attempts>
<use-duplicate-detection>true</use-duplicate-detection>
<message-load-balancing>ON_DEMAND</message-load-balancing>
<max-hops>1</max-hops>
<confirmation-window-size>1048576</confirmation-window-size>
<call-failover-timeout>-1</call-failover-timeout>
<notification-interval>1000</notification-interval>
<notification-attempts>2</notification-attempts>
<static-connectors allow-direct-connections-only="true">
<connector-ref>Master_B</connector-ref>
<connector-ref>Master_C</connector-ref>
<connector-ref>Slave_B</connector-ref>
</static-connectors>
</cluster-connection>
</cluster-connections>
<ha-policy>
<replication>
<master>
<check-for-live-server>true</check-for-live-server>
<vote-on-replication-failure>false</vote-on-replication-failure>
</master>
</replication>
</ha-policy>
和Slavebroc. xml
:
<connectors>
<connector name="Slave_B">tcp://[HOSTNAME]:[B_SLAVE_PORT]</connector>
<connector name="Master_A">tcp://[HOSTNAME]:[A_MASTER_PORT]</connector>
</connectors>
<cluster-connections>
<cluster-connection name="artemis-cluster">
<address></address>
<connector-ref>B_slave_connector</connector-ref>
<check-period>30000</check-period>
<connection-ttl>60000</connection-ttl>
<min-large-message-size>102400</min-large-message-size>
<call-timeout>30000</call-timeout>
<retry-interval>500</retry-interval>
<retry-interval-multiplier>1.0</retry-interval-multiplier>
<max-retry-interval>5000</max-retry-interval>
<initial-connect-attempts>-1</initial-connect-attempts>
<reconnect-attempts>-1</reconnect-attempts>
<use-duplicate-detection>true</use-duplicate-detection>
<message-load-balancing>ON_DEMAND</message-load-balancing>
<max-hops>1</max-hops>
<confirmation-window-size>1048576</confirmation-window-size>
<call-failover-timeout>-1</call-failover-timeout>
<notification-interval>1000</notification-interval>
<notification-attempts>2</notification-attempts>
<static-connectors allow-direct-connections-only="true">
<connector-ref> Master_A</connector-ref>
</static-connectors>
</cluster-connection>
</cluster-connections>
<ha-policy>
<replication>
<slave>
<max-saved-replicated-journals-size>-1</max-saved-replicated-journals-size>
<restart-backup>false</restart-backup>
<allow-failback>true</allow-failback>
<vote-on-replication-failure>false</vote-on-replication-failure>
</slave>
</replication>
</ha-policy>
问题是,我是按照[Artemis留档][1]中推荐的顺序启动这些节点的-所有的主节点在一起,所有的从节点在一起。即使很艰难,拓扑也不是我声明的那样,主节点连接到错误的从节点…(它们实际上不应该连接到这些节点,因为我将连接配置为only-Direct-连接
)。
如果您想将特定的主备配对在一起,您的配置不合适。留档讨论了必要的配置:
在集群中,备份服务器有两种方法可以找到要从中复制的实时服务器,它们是:
>
指定节点组
。您可以指定备份服务器可以连接到的一组实时服务器。这是通过在master
或broc. xml
的从节点
元素中配置group-name
来完成的。备份服务器只会连接到共享相同节点组名称的实时服务器
连接到任何实时
。如果未配置group-name
,这将是允许备份服务器连接到任何实时服务器的行为
目前您没有指定group-name
,这意味着备份将连接到任何实时代理。