有没有办法在分布式 ActiveMQ 集群中故障转移消息?

发布于 2024-12-10 17:05:16 字数 74 浏览 0 评论 0 原文

在分布式activemq集群中,如果一个节点发生故障,它的消息就会丢失,直到它恢复为止。即使节点发生故障,是否有办法继续分发这些消息?

In a distributed activemq cluster, if a node fails, its messages are lost until it comes back. Is there a way to keep distributing these messages even if a node fails ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

满意归宿 2024-12-17 17:05:16

是的,您可以使用共享消息存储并让多个代理使用该存储来执行此操作。这些经纪人中只有一个在任何时候都会处于活动状态 - 第一个连接到商店的经纪人。这是通过锁来管理的。当活动代理失败时,第二个代理将获取锁,然后它变为活动状态,处理存储中第一个代理未发送的任何消息。客户端(生产者和消费者)通过连接字符串连接到代理对

failover:(tcp://broker1Host:broker1Port,tcp://broker2Host:broker2port)

。只有持有锁的代理才会接受连接,因此故障转移字符串指定客户端应尝试连接到列表中的下一个代理。使用这种机制,甚至可以让多个从设备等待在主设备发生故障时接管。

您可以在 http://activemq.apache.org 找到更多相关信息/shared-file-system-master-slave.html 如果您有权访问支持锁的网络文件系统(例如 SAN 或 NFS),或者如果没有,您可以使用数据库作为消息存储<一href="http://activemq.apache.org/jdbc-master-slave.html" rel="nofollow">http://activemq.apache.org/jdbc-master-slave.html

Yes, you do this using a shared message store and having multiple brokers use that store. Only one of these brokers will be active at any time - the one that connected to the store first. This is managed via locks. When the active broker falls over the second broker will pick up the lock and it then becomes active, handling any messages in the store that were not sent by the first broker. Clients (producers and consumers) connect to the broker pair via the connection string

failover:(tcp://broker1Host:broker1Port,tcp://broker2Host:broker2port)

Only the broker that holds the lock will accept connections, so the failover string specifies that the client should attempt to connect to the next broker in the list. Using this mechanism it is even possible to have multiple slaves waiting to take over if the master fails.

You can find more information about this at http://activemq.apache.org/shared-file-system-master-slave.html if you have access to a network file system that supports locks (such as a SAN, or NFS), or if not you can use a database as your message store http://activemq.apache.org/jdbc-master-slave.html

等你爱我 2024-12-17 17:05:16

你想要主从哈吗?
http://activemq.apache.org/masterslave.html

运行大量独立经纪人或经纪人的问题
网络的特点是消息在任何时候都由单个物理代理拥有
时间点。如果该经纪商出现故障,您必须等待它恢复
在消息传送之前重新启动。 (如果您正在使用
非持久消息传递和代理宕机,您通常会损失
您的消息)。

MasterSlave 背后的想法是将消息复制到从属服务器
代理,这样即使您遇到灾难性的硬件故障
主站的机器、文件系统或数据中心,您可以立即获得
故障转移到从属设备,不会丢失消息。

更多信息请参见: http://activemq.apache.org/replicated-message-store.html< /a>

Do you want the master-slave ha?
http://activemq.apache.org/masterslave.html

The problem with running lots of stand alone brokers or brokers in a
network is that messages are owned by a single physical broker at any
point in time. If that broker goes down, you have to wait for it to be
restarted before the message can be delivered. (If you are using
non-persistent messaging and a broker goes down you generally lose
your message).

The idea behind MasterSlave is that messages are replicated to a slave
broker so that even if you have catastrophic hardware failure of the
master's machine, file system or data centre, you get immediate
failover to the slave with no message loss.

More here: http://activemq.apache.org/replicated-message-store.html

暖阳 2024-12-17 17:05:16

创建一个代理网络,其中每个代理都有一个从属代理(例如直接复制)。
这样,如果主服务器发生故障,从服务器可以加入代理网络并取代其前主服务器的位置。根据您选择的复制方案,前主代理甚至可能恢复并作为从节点重新加入新主节点。

例如: 经纪人网络

据我所知,不可能“强制” “ activemq 冗余地存储挂起的消息几个经纪人。

create a broker network where every broker has a slave (for example with direct replication).
this way if the master fails the slave can join the broker network and take the position of its former master. depending on your chosen replication scheme the former master broker might even recover and rejoin the new master as a slave node.

for example: direct replication within a network of brokers

As far as i know its not possible to "force" activemq to store pending messages redundantly on several brokers.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文