ActiveMQ 集群(1)
Queue consumer clusters(消费者集群):
简介: 同一个queue,如果一个消费者失效, 那么任何未经确认的消息将会被发送给queue上的其它消费者。如果一个消费者比其它消费者执行的更快,它将会消费更多的消息。如果任何一个消费者执行速度变慢,那么其他消费者将来弥补空缺。所以,消费者在(队列中)处理消息时,可以有一个可靠的负载均衡。
实现原理: 消费者对消息的处理速率可能不同,对于broker而言,它无法意识到哪个消费者处于"空闲"状态,故消费者空闲时主动向broker请求消息,如此还能有一个良好的"负载均衡".
消费者集群不需要特殊的配置,即可使用。
消费者集群,主要用于解决 消费者间的负载均衡。
Broker clusters(MQ集群)
简介: 一个client连接多台broker中的一台(brokerA)。如果brokerA 挂了,那么client可自动重新连接到其它的 broker(brokerB)上。但是,brokerB并不会识别其它broker上的消费者,如果brokerB没有可识别的消费者,那么brokerB上的消息会因为得不到处理而被堆积起来。
目前的解决方案是使用 Network of brokers,在brokers之间实现存储转发消息。
有2种方式实现 broker集群:
(1) 使用网络连接(Network of brokers)方式:
网络连接方式: 通过把多台不同的broker连接在一起,作为一个整体对外提供服务,从而提高整体对外的消息服务能力。通过这种方式,brokers可以共享队列和消费者列表,从而达到分布式队列的目的。
① 可以同时运行任意多个broker和client。(broker集群 + client集群)
② client可连接到任意一台broker上,若这台broker挂了,client可自动重新连 接到另一台broker上。
实现原理: 通过实现静态发现或动态发现,client可以在一台broker挂了之后,自动地监测并且连接到网络中其它的broker上,同时,也可用于一台broker去发现并且连接到网络中其它的broker上。
Netword of brokers的目的: 提供存储和转发消息到另一台broker上,以实现broker负载均衡,提高消息处理能力。
(2) 使用Master/Slave方式:
背景: 由于client属于broker的,若某台broker挂了,消息只能等待broker重启后, 再被继续消费。
所以: 解决方案是,一台broker作为Master,一台broker作为Slave, 实时的把Master上的消息备份到Slave上。若Master挂了,则服务立即切换至Slave上运行。故消息不会丢失。
那么一个broker如何发现其它的broker呢?
通过使用静态发现或动态发现,当某台broker挂了时,client可以自动地监测到并且重新连接到网络中其它的broker上。同时,利用这个协议,broker也可以发现并且连接到网络中其它的broker上。在 ActiveMQ 中,client通过使用 failover:// 协议来实现这个功能。
即: client通过使用failover://协议,若broker挂了,client会自动监测到这种情况并且重新连接到其它的broker上。
Broker通过使用静态发现或动态发现,可以连接到其它的broker上。
英文参考文档:
Broker clusters:
there is a collection of JMS brokers and a JMS client will connect to one of them; then if the JMS broker goes down, it will auto-reconnect to another broker.
We implement this using the failover:// protocol in the JMS client. See the Failover Transport Reference page for details of how to configure the failover protocol.
If we just run multiple brokers on a network and tell the clients about them using either static discovery or dynamic discovery then clients can easily failover from one broker to another. However stand alone brokers don't know about consumers on other brokers; so if there are no consumers on a certain broker messages could just pile up without being consumed. Currently the solution to this problem is to create a Network of brokers to store and forward messages between brokers.
Discovery of brokers
We support auto-discovery of brokers using static discovery or dynamic discovery so clients can automatically detect and connect to a broker from brokers, as well for brokers to discover and connect to other brokers.
Networks of brokers
If you have many clients and many brokers, there is a chance that one broker has producers but no consumers so that messages pile up without being processed. To avoid this ActiveMQ supports a Networks of Brokers which provides store and forward to move messages from brokers with producers to brokers with consumers which allows us to support distributed queues and topics across a network of brokers.
This allows a client to connect to any broker - and fail over to another broker if there is a failure - providing from the clients perspective a cluster of brokers.
Networks of brokers also allows us to scale up to massive number of clients in a network as we can run as many brokers as we need.
You can think of this as a cluster of clients connecting with a cluster of brokers with auto-failover and discovery making a simple and easy to use messaging fabric.
Borker网络连接:
Networks of Brokers目的:提供存储转发消息到另一台broker上。 实现负载均衡,提高消息处理能力。
附加: http://activemq.apache.org/clustering.html
ActiveMQ 集群(1)的更多相关文章
- ActiveMQ集群应用
ActiveMQ集群 ActiveMQ具有强大和灵活的集群功能,但在使用的过程中会发现很多的缺点,ActiveMQ的集群方式主要由两种:Master-Slave和Broker Cluster. 1.M ...
- 使用jmeter对ActiveMQ集群性能方案进行评估--转载
原文地址:http://www.51testing.com/html/78/23978-143163.html 1.测试概要1.1 关于这篇文档中涉及的基于JMS的消息系统能为应用程序提供可靠的,高性 ...
- 分布式ActiveMQ集群
分布式ActiveMQ集群的部署配置细节: 官方资料:http://activemq.apache.org/clustering.html 基本上看这个就足够了,本文就不具体分析配置文件了. 1.Qu ...
- ActiveMQ集群(2)
ActiveMQ具有强大和灵活的集群功能,但在使用的过程中会发现很多的缺点,ActiveMQ的集群方式主要有两种:Master-Slave和Broker Cluster. 1.Master-Slave ...
- 分布式ActiveMQ集群--转载
原文地址:http://shensy.iteye.com/blog/1752529 回顾总结前一段时间学习的ActiveMQ分布式集群相关的知识,分享出来希望对看到的人有所帮助. 一.分布式Activ ...
- Azure上搭建ActiveMQ集群-基于ZooKeeper配置ActiveMQ高可用性集群
ActiveMQ从5.9.0版本开始,集群实现方式取消了传统的Master-Slave方式,增加了基于ZooKeeper+LevelDB的实现方式. 本文主要介绍了在Windows环境下配置基于Zoo ...
- ActiveMQ集群简单测试+eclipse Zookeeper 插件 + 负载均衡
ActiveMQ集群搭建好之后,接下来就该测试一下了. 一.先安装Zookeeper 的eclipse插件吧. 1. 打开 eclipse, Help -> Install New Softwa ...
- ActiveMQ集群
1.ActiveMQ集群介绍 1.为什么要集群? 实现高可用,以排除单点故障引起的服务中断 实现负载均衡,以提升效率为更多客户提供服务 2.集群方式 客户端集群:让多个消费者消费同一个队列 Broke ...
- ActiveMQ集群方案
集群方案主要为了解决系统架构中的两个关键问题:高可用和高性能.ActiveMQ服务的高可用性是指,在ActiveMQ服务性能不变.数据不丢失的前提下,确保当系统灾难出现时ActiveMQ能够持续提供消 ...
- 47.ActiveMQ集群
(声明:本文非EamonSec原创) 使用ZooKeeper实现的Master-Slave实现方式,是对ActiveMQ进行高可用的一种有效的解决方案,高可用的原理:使用ZooKeeper(集群)注册 ...
随机推荐
- http概述
HTTP是一个属于应用层的面向对象的协议,由于其简捷.快速的方式,适用于分布式超媒体信息系统.它于1990年提出,经过几年的使用与发展,得到不断地完善和扩展.目前在WWW中使用的是HTTP/1.0的第 ...
- 自定义控件(模仿微信ToggleButton控件)
弄过android开发的都知道,系统有一个默认的ToggleButton,但很多人都觉得他很难看,当然也包括我.如果你感觉他不难看,那你就继续使用系统的吧,这篇文章对你来说是多余的了. 今天来写一个模 ...
- Elasticsearch 5.0
Elasticsearch 5.0 使用ES的基本都会使用过head,但是版本升级到5.0后,head插件就不好使了.下面就看看如何在5.0中启动Head插件吧! 官方粗略教程 Running wit ...
- Mac下运行ASP.NET Core应用程序
Mac下运行ASP.NET Core应用程序 在Mac下运行ASP.NET Core应用程序 通过参照.NET Core相关官方文档,在我的Mac电脑上用Visual Studio Code创建了我的 ...
- LintCode-Median II
Numbers keep coming, return the median of numbers at every time a new number added. Example For numb ...
- 将Xml字符串转换成(DataTable || DataSet || XML)对象
今天用到一个功能:就是把从数据库读出来的内容转换成XML字符串流格式,并输出给一个功能函数.在写的过程,为方便以后的使用,我对这一功能进行分装.该类的具体格式如下:XmlConvert类命名空间:Ni ...
- 学习Linux第一天
1.简介: 记住这个名字:Linus Torvals 系统组成:Linux内核,Shell, 文件系统,实时程序 Tips:在系统启动过程中,使用Alt+F2组合键,可以查看Ubuntu启动的详细过程 ...
- BZOJ 1143: [CTSC2008]祭祀river 最大独立集
题目链接: http://www.lydsy.com/JudgeOnline/problem.php?id=1143 题解: 给你一个DAG,求最大的顶点集,使得任意两个顶点之间不可达. 把每个顶点v ...
- Spring中HibernateCallback的用法(转)
Hibernate的复杂用法HibernateCallback HibernateTemplate还提供一种更加灵活的方式来操作数据库,通过这种方式可以完全使用Hibernate的操作方式.Hiber ...
- spring配置事务
一.配置JDBC事务处理机制 <!-- 配置Hibernate事务处理 --> <bean id="transactionManager" class=" ...