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)的更多相关文章

  1. ActiveMQ集群应用

    ActiveMQ集群 ActiveMQ具有强大和灵活的集群功能,但在使用的过程中会发现很多的缺点,ActiveMQ的集群方式主要由两种:Master-Slave和Broker Cluster. 1.M ...

  2. 使用jmeter对ActiveMQ集群性能方案进行评估--转载

    原文地址:http://www.51testing.com/html/78/23978-143163.html 1.测试概要1.1 关于这篇文档中涉及的基于JMS的消息系统能为应用程序提供可靠的,高性 ...

  3. 分布式ActiveMQ集群

    分布式ActiveMQ集群的部署配置细节: 官方资料:http://activemq.apache.org/clustering.html 基本上看这个就足够了,本文就不具体分析配置文件了. 1.Qu ...

  4. ActiveMQ集群(2)

    ActiveMQ具有强大和灵活的集群功能,但在使用的过程中会发现很多的缺点,ActiveMQ的集群方式主要有两种:Master-Slave和Broker Cluster. 1.Master-Slave ...

  5. 分布式ActiveMQ集群--转载

    原文地址:http://shensy.iteye.com/blog/1752529 回顾总结前一段时间学习的ActiveMQ分布式集群相关的知识,分享出来希望对看到的人有所帮助. 一.分布式Activ ...

  6. Azure上搭建ActiveMQ集群-基于ZooKeeper配置ActiveMQ高可用性集群

    ActiveMQ从5.9.0版本开始,集群实现方式取消了传统的Master-Slave方式,增加了基于ZooKeeper+LevelDB的实现方式. 本文主要介绍了在Windows环境下配置基于Zoo ...

  7. ActiveMQ集群简单测试+eclipse Zookeeper 插件 + 负载均衡

    ActiveMQ集群搭建好之后,接下来就该测试一下了. 一.先安装Zookeeper 的eclipse插件吧. 1. 打开 eclipse, Help -> Install New Softwa ...

  8. ActiveMQ集群

    1.ActiveMQ集群介绍 1.为什么要集群? 实现高可用,以排除单点故障引起的服务中断 实现负载均衡,以提升效率为更多客户提供服务 2.集群方式 客户端集群:让多个消费者消费同一个队列 Broke ...

  9. ActiveMQ集群方案

    集群方案主要为了解决系统架构中的两个关键问题:高可用和高性能.ActiveMQ服务的高可用性是指,在ActiveMQ服务性能不变.数据不丢失的前提下,确保当系统灾难出现时ActiveMQ能够持续提供消 ...

  10. 47.ActiveMQ集群

    (声明:本文非EamonSec原创) 使用ZooKeeper实现的Master-Slave实现方式,是对ActiveMQ进行高可用的一种有效的解决方案,高可用的原理:使用ZooKeeper(集群)注册 ...

随机推荐

  1. 菜鸟学习Struts——配置Struts环境

    刚开始学习Struts,它通过采用JavaServlet/JSP技术,实现了基于Java EEWeb应用的MVC设计模式的应用框架,是MVC经典设计模式中的一个经典产品. 要用到Struts就要学会配 ...

  2. db2查看表空间

    select substr(tbsp_name,1,20) as 表空间名称,substr(tbsp_content_type,1,10) as 表空间类型,sum(tbsp_total_size_k ...

  3. yii2.0 控制器加载不同的user组件

     Yii::$app->user->id  Yii::$app->user2->id Yii::$app->admin->id          identityC ...

  4. <亲测好使>mac os 安装mcrypt扩展

    以前安装opencart的时候倒是不需要mcrypt 这个库.但是新版本需要了.加上自己的 是mac环境.当时闲麻烦,就一直没装.这次下午就寻思给装上吧! 1.首先你要先安装xcode这个工具.不然没 ...

  5. 2016 系统设计第一期 (档案一)jQuery radio 取值赋值

    MVC代码: <div class="form-group"> <label for="Gender" class="col-sm- ...

  6. Aspose 数字和日期 设置

    Microsoft Excel一个非常强大的功能就是使客户可以设置数字和日期的显示格式,众所周知数字可以显示为不同的值格式,包含:小数.货币.百分数.分数.账面价值等,同样地Aspose.Cells也 ...

  7. Using self-defined Parcelable objects during an Android AIDL RPC / IPC call

    Using self-defined Parcelable objects during an Android AIDL RPC / IPC call In my previous post “Usi ...

  8. ffmpeg 编码

    编码可以简单理解为将连续的图片帧转变成视频流的过程.以H264为例给出编码的代码: int InitEncoderCodec(int width, int height) { auto enc = a ...

  9. Android Studio:Gradle常用命令

    Android Studio中自带Terminal,可以直接使用gradle命令,不必另开命令窗口,相当方便,下面总结一下常用的命令: 1.查看Gradle版本号      ./gradlew -v  ...

  10. MoveManager管理类

    MoveManager:移动管理类 struct MoveOpt { int cur_seq; ObjecInfo* obj; }; std::map<ObjID, MoveOpt> m_ ...