这里是基于 zookeeper 选举方式实现的集群配置,服务器过半数才可提供服务,所以是2n+1台这里以三台为例。

只有master节点能提供服务,slave节点无法提供服务,只有当master节点挂了,slave重新选举出的主节点才能提供服务(灰色部分都是默认配置文件)

<!--Licensed to the Apache Software Foundation (ASF) under one or morecontributor license agreements.  See the NOTICE file distributed withthis work for additional information regarding copyright ownership.The ASF licenses this file to You under the Apache License, Version 2.0(the "License"); you may not use this file except in compliance withthe License.  You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.
-->
<!-- START SNIPPET: example -->
<beansxmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdhttp://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd"><!-- Allows us to use system properties as variables in this configuration file --><bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"><property name="locations"><value>file:${activemq.conf}/credentials.properties</value></property></bean><!-- Allows accessing the server log --><bean id="logQuery" class="io.fabric8.insight.log.log4j.Log4jLogQuery"lazy-init="false" scope="singleton"init-method="start" destroy-method="stop"></bean><!--The <broker> element is used to configure the ActiveMQ broker.--><broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}"><destinationPolicy><policyMap><policyEntries><policyEntry topic=">" ><!-- The constantPendingMessageLimitStrategy is used to preventslow topic consumers to block producers and affect other consumersby limiting the number of messages that are retainedFor more information, see:http://activemq.apache.org/slow-consumer-handling.html--><pendingMessageLimitStrategy><constantPendingMessageLimitStrategy limit="1000"/></pendingMessageLimitStrategy></policyEntry></policyEntries></policyMap></destinationPolicy><!--The managementContext is used to configure how ActiveMQ is exposed inJMX. By default, ActiveMQ uses the MBean server that is started bythe JVM. For more information, see:http://activemq.apache.org/jmx.html--><managementContext><managementContext createConnector="false"/></managementContext><!--Configure message persistence for the broker. The default persistencemechanism is the KahaDB store (identified by the kahaDB tag).For more information, see:http://activemq.apache.org/persistence.html--><!--使用zookeeper作集群配置将默认的kahadb持久化方式注释掉,替换为leveldbreplicas = 机器总数/2+1  例如3台机器至少需要2台存活,7台至少需要4台存活bind  集群数据同步的端口(自定义只要不与本机服务器其他端口冲突即可)zkAddress zk地址,集群可以逗号隔开  ip1:2181,ip2:2181,ip3:2181hostname  本机ipzkPath mq注册在zk的临时节点位子          所以我们在部署集群的时候,只需要改hostname就好了,其他地方都一样!--><persistenceAdapter><!--<kahaDB directory="${activemq.data}/kahadb"/>--><replicatedLevelDB directory="${activemq.data}/levelDB"replicas="2" bind="tcp://0.0.0.0:61615"zkAddress="10.97.47.96:2181"hostname="192.168.5.6"zkPath="/activemq/leveldb"/></persistenceAdapter><!--The systemUsage controls the maximum amount of space the broker willuse before disabling caching and/or slowing down producers. For more information, see:http://activemq.apache.org/producer-flow-control.html--><systemUsage><systemUsage><memoryUsage><memoryUsage percentOfJvmHeap="70" /></memoryUsage><storeUsage><storeUsage limit="100 gb"/></storeUsage><tempUsage><tempUsage limit="50 gb"/></tempUsage></systemUsage></systemUsage><!--The transport connectors expose ActiveMQ over a given protocol toclients and other brokers. For more information, see:http://activemq.apache.org/configuring-transports.html--><transportConnectors><!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB --><transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/><transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/><transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/><transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/><transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/></transportConnectors><!-- destroy the spring context on shutdown to stop jetty --><shutdownHooks><bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook" /></shutdownHooks></broker><!--Enable web consoles, REST and Ajax APIs and demosThe web consoles requires by default login, you can disable this in the jetty.xml fileTake a look at ${ACTIVEMQ_HOME}/conf/jetty.xml for more details--><import resource="jetty.xml"/>
</beans>
<!-- END SNIPPET: example -->

测试:可以看到3台服务器都注册到了zk上,且只有master能提供服务!

高可用 + 高性能的解决方案

转载于:https://www.cnblogs.com/wlwl/p/9836038.html

activemq高可用相关推荐

  1. JMS之——ActiveMQ 高可用与负载均衡集群安装、配置(ZooKeeper + LevelDB + Static discovery)...

    一.说明 从 ActiveMQ 5.9 开始, ActiveMQ 的集群实现方式取消了传统的 Master-Slave 方式,增加了基于ZooKeeper + LevelDB 的 Master-Sla ...

  2. 基于zookeeper(集群)+LevelDB的ActiveMq高可用集群安装、配置、测试

    Linux 环境 zookeeper集群安装.配置.测试https://blog.csdn.net/weixin_40816738/article/details/100576259 MQ集群部署规划 ...

  3. 亿级流量电商详情页系统实战:缓存架构+高可用服务架构+微服务架构

    <缓存架构+高可用服务架构+微服务架构>深入讲解了亿级流量电商详情页系统的完整大型架构.同时最重要的是,在完全真实的大型电商详情页系统架构下,全流程实战了整套微服务架构,包含了基于领域驱动 ...

  4. 高可用、可扩展、稳定和安全的消息队列ActiveMQ特点分析

    ActiveMQ是Apache软件基金下的一个开源软件.是目前能力强劲.应用广泛的开源消息总线之一.它为企业消息传递提供高可用.出色性能.可扩展.稳定和安全保障.ActiveMQ的目标是在尽可能多的平 ...

  5. Kafka、ActiveMQ、RabbitMQ、RocketMQ 区别以及高可用原理

    为什么使用消息队列 其实就是问问你消息队列都有哪些使用场景,然后你项目里具体是什么场景,说说你在这个场景里用消息队列是什么? 面试官问你这个问题,期望的一个回答是说,你们公司有个什么业务场景,这个业务 ...

  6. ActiveMQ实现负载均衡+高可用部署方案

    2019独角兽企业重金招聘Python工程师标准>>> 一.架构和技术介绍 1.简介 ActiveMQ 是Apache出品,最流行的,能力强劲的开源消息总线.完全支持JMS1.1和J ...

  7. ActiveMQ的集群与高可用

    ActiveMQ的集群与高可用 针对大量的消息吞吐量.对MQ可用性要求非常严格的场景.或者非常复杂的消息处理关系情况下,单个MQ实例通常已经无法满足我们的需要,这时候ActiveMQ的集群和高可用方案 ...

  8. Spring Cloud(十一)高可用的分布式配置中心 Spring Cloud Bus 消息总线集成(RabbitMQ)

    上一篇文章,留了一个悬念,Config Client 实现配置的实时更新,我们可以使用 /refresh 接口触发,如果所有客户端的配置的更改,都需要手动触发客户端 /refresh ,当服务越来越多 ...

  9. bootstrap3 表单构建器_实例演示:如何构建高可用的微服务架构

    R 5月8日晚20:30,Kubernetes Master Class在线培训第五期<Kubernetes中的日志.监控与告警> 当你设计和构建大规模应用时,你将面临两个重大挑战:可伸缩 ...

最新文章

  1. Linux 2.6 中的直接 I/O 技术
  2. UA MATH566 统计理论2 点估计基础
  3. Tomcat源码分析--转
  4. 【BZOJ1085】骑士精神
  5. 前端学习(648):转换为boolean
  6. 面向对象的JavaScript基本知识指南大全
  7. android 常用命令随手记
  8. 【计算机网络】网络基础知识和TCP/IP协议族
  9. JAVA命令符找不到符号_java: 找不到符号 符号: 方法 setLatestEventInfoentInfo
  10. openffice安装(windows和linux)
  11. 靡不有初,鲜克有终——写在VNote半周岁
  12. android 仿美团日历,仿小米日历 纵享丝滑切换的周月效果
  13. 计算机软件系统 七年级,系统软件作用大七年级信息技术教案(5页)-原创力文档...
  14. SQL Server 排序函数 ROW_NUMBER和RANK 用法总结
  15. HDU-6148 Valley Numer(数位DP)
  16. “decompose“没有适用于“ts“目标对象的方法
  17. python面试自我介绍_python自我描述
  18. Lua学习笔记(一)
  19. Excel 数字转日期类型
  20. 迅雷起死回生背后的男人,竟然是雷军

热门文章

  1. Express使用进阶:cookie-parser中间件实现深入剖析
  2. Mac DBeaver Client home is not specified for connection解决办法
  3. Swift中的数据存储
  4. EF架构~将数据库注释添加导入到模型实体类中
  5. 《XNA游戏开发》简介
  6. 学以致用 知行合一 ——《产品管理与研发项目管理》课程有感
  7. [管理]《高绩效人士的五项管理》 -- 李践
  8. 庆祝.Net BI团队成立!
  9. [swift] LeetCode 169. Majority Element
  10. 【软件测试】α测试和β测试的区别