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(集群)注册 ...
随机推荐
- C#实现发送邮件——核心部分代码
在KS系统中有个发送邮件的功能需要做上网查阅资料以后,通过自己的部分修改实现了发送邮件的功能话不多说先来个界面: 邮件发送分一下步骤: 1.smtp服务信息设置 2.验证发件人信息 3.添加附件 4. ...
- RaddioButton控件
<GroupBox Margin="5"> <StackPanel> <RadioButton IsChecked="true"& ...
- c++内存分配
[导语] 内存管理是C++最令人切齿痛恨的问题,也是C++最有争议的问题,C++高手从中获得了更好的性能,更大的自由,C++菜鸟的收获则是一遍一遍的检查代码和对C++的痛恨,但内存管理在C++中无处不 ...
- 首页视频播放jquery
<script type="text/javascript" src="[!--news.url--]skin/default/js/flowplayer-3.2. ...
- 服务器端spice配置详解
1. 安装必要的工具 sudo apt-get install build-essential autoconf git-core intltool 2. 安装必要的依赖包 -dev libxfixe ...
- 关于MDK中:RO-data、RW-data、ZI-data
最近在LPC2109上调试ENC28J60,协议栈使用的是UIP,刚开始用的telnet服务,能够正常编译运行.然后换成webserver提示: enc28j60.axf: Error: L6406E ...
- 高性能网络编程1----accept建立连接
转 http://taohui.org.cn/tcpperf1.html 陶辉 taohui.org.cn 回到应用层,往往只需要调用类似于accept的API就可以建立TCP连接.建立连接的流程大 ...
- jquerymobile局部渲染的各种刷新
在JQueryMobile页面在第一次初始化进行一次整体渲染,动态生成的需要局部渲染. 在jquerymobile实现listview局部渲染的方法: function queryPublishOrd ...
- Java 泛型(Generics)
Generics, 类似C++中的模版. 允许在定义类和接口的时候使用类型参数(type parameters), 声明的类型参数在使用的时候用具体的类型来替换. 如 ArrayList<Str ...
- Git fetch和git pull的区别(转)
原文: http://www.tech126.com/git-fetch-pull/ Git中从远程的分支获取最新的版本到本地有这样2个命令:1. git fetch:相当于是从远程获取最新版本到本地 ...