rocketmq  并且编译下载

wget  http://mirror.bit.edu.cn/apache/rocketmq/4.3.2/rocketmq-all-4.3.2-source-release.zip
unzip rocketmq-all-4.3.-source-release.zip
cd rocketmq-all-4.3./
mvn -Prelease-all -DskipTests clean install -U
cd distribution/target/apache-rocketmq

拷贝 apache-rocketmq 到 /data/rocketmq目录下

[root@rocketmq1 data]# cd /data/rocketmq-all-4.3./distribution/target/
[root@rocketmq1 target]# cp apache-rocketmq /data/rocketmq -ar

修改配置文件,以 vim /data/rocketmq/conf/2m-noslave/broker-a.properties 为例

rocketmqHome=/data/rocketmq
# 如果是一个nameserver,直接写一个地址即可
namesrvAddr=172.16.230.21:;172.16.230.22:;172.16.230.23:
brokerName=borker-a
brokerClusterName=DefaultCluster
brokerId=
brokerPermission=
#在发送消息时,自动创建服务器不存在的topic,默认创建的队列数
defaultTopicQueueNums=
#是否允许 Broker 自动创建Topic,建议线下开启,线上关闭
autoCreateTopicEnable=true
clusterTopicEnable=true
brokerTopicEnable=true
#是否允许 Broker 自动创建订阅组,建议线下开启,线上关闭
autoCreateSubscriptionGroup=true
sendMessageThreadPoolNums=
pullMessageThreadPoolNums=
queryMessageThreadPoolNums=
adminBrokerThreadPoolNums=
clientManageThreadPoolNums=
consumerManageThreadPoolNums=
heartbeatThreadPoolNums=
endTransactionThreadPoolNums=
flushConsumerOffsetInterval=
flushConsumerOffsetHistoryInterval=
rejectTransactionMessage=false
fetchNamesrvAddrByAddressServer=false
sendThreadPoolQueueCapacity=
pullThreadPoolQueueCapacity=
queryThreadPoolQueueCapacity=
clientManagerThreadPoolQueueCapacity=
consumerManagerThreadPoolQueueCapacity=
heartbeatThreadPoolQueueCapacity=
endTransactionPoolQueueCapacity=
filterServerNums=
longPollingEnable=true
shortPollingTimeMills=
notifyConsumerIdsChangedEnable=true
highSpeedMode=false
commercialEnable=true
commercialTimerCount=
commercialTransCount=
commercialBigCount=
commercialBaseCount=
transferMsgByHeap=true
maxDelayTime=
regionId=DefaultRegion
registerBrokerTimeoutMills=
slaveReadEnable=false
disableConsumeIfConsumerReadSlowly=false
consumerFallbehindThreshold=
brokerFastFailureEnable=true
waitTimeMillsInSendQueue=
waitTimeMillsInPullQueue=
waitTimeMillsInHeartbeatQueue=
waitTimeMillsInTransactionQueue=
startAcceptSendRequestTimeStamp=
traceOn=true
enableCalcFilterBitMap=false
expectConsumerNumUseFilter=
maxErrorRateOfBloomFilter=
filterDataCleanTimeSpan=
filterSupportRetry=false
enablePropertyFilter=false
compressedRegister=false
forceRegister=true
registerNameServerPeriod=
transactionTimeOut=
transactionCheckMax=
transactionCheckInterval=
#Broker 对外服务的监听端口
listenPort=
serverWorkerThreads=
serverCallbackExecutorThreads=
serverSelectorThreads=
serverOnewaySemaphoreValue=
serverAsyncSemaphoreValue=
serverChannelMaxIdleTimeSeconds=
serverSocketSndBufSize=
serverSocketRcvBufSize=
serverPooledByteBufAllocatorEnable=true
useEpollNativeSelector=false
clientWorkerThreads=
clientCallbackExecutorThreads=
clientOnewaySemaphoreValue=
clientAsyncSemaphoreValue=
connectTimeoutMillis=
channelNotActiveInterval=
clientChannelMaxIdleTimeSeconds=
clientSocketSndBufSize=
clientSocketRcvBufSize=
clientPooledByteBufAllocatorEnable=false
clientCloseSocketIfTimeout=false
useTLS=false
storePathRootDir=/data/rocketmq/store
storePathCommitLog=/root/rocketmq/store/commitlog
#commitLog每个文件的大小默认1G
mapedFileSizeCommitLog=
#ConsumeQueue每个文件默认存60W条,根据业务情况调整,
mapedFileSizeConsumeQueue=
enableConsumeQueueExt=false
mappedFileSizeConsumeQueueExt=
bitMapLengthConsumeQueueExt=
flushIntervalCommitLog=
commitIntervalCommitLog=
useReentrantLockWhenPutMessage=false
flushCommitLogTimed=false
flushIntervalConsumeQueue=
cleanResourceInterval=
deleteCommitLogFilesInterval=
deleteConsumeQueueFilesInterval=
destroyMapedFileIntervalForcibly=
redeleteHangedFileInterval=
#删除文件时间点,默认凌晨 2点
deleteWhen=
#检测物理文件磁盘空间
diskMaxUsedSpaceRatio=
#文件保留时间,默认 小时
fileReservedTime=
putMsgIndexHightWater=
#限制的消息大小
maxMessageSize=
checkCRCOnRecover=true
flushCommitLogLeastPages=
commitCommitLogLeastPages=
flushLeastPagesWhenWarmMapedFile=
flushConsumeQueueLeastPages=
flushCommitLogThoroughInterval=
commitCommitLogThoroughInterval=
flushConsumeQueueThoroughInterval=
maxTransferBytesOnMessageInMemory=
maxTransferCountOnMessageInMemory=
maxTransferBytesOnMessageInDisk=
maxTransferCountOnMessageInDisk=
accessMessageInMemoryMaxRatio=
messageIndexEnable=true
maxHashSlotNum=
maxIndexNum=
maxMsgsNumBatch=
messageIndexSafe=false
haListenPort=
haSendHeartbeatInterval=
haHousekeepingInterval=
haTransferBatchSize=
haMasterAddress=
haSlaveFallbehindMax=
brokerRole=ASYNC_MASTER
flushDiskType=ASYNC_FLUSH
syncFlushTimeout=
messageDelayLevel=1s 5s 10s 30s 1m 2m 3m 4m 5m 6m 7m 8m 9m 10m 20m 30m 1h 2h
flushDelayOffsetInterval=
cleanFileForciblyEnable=true
warmMapedFileEnable=false
offsetCheckInSlave=false
debugLockEnable=false
duplicationEnable=false
diskFallRecorded=true
osPageCacheBusyTimeOutMills=
defaultQueryMaxNum=
transientStorePoolEnable=false
transientStorePoolSize=
fastFailIfNoBufferInStorePool=false

修改配置文件,以 vim /data/rocketmq/conf/2m-noslave/broker-b.properties 为例

rocketmqHome=/data/rocketmq
# 如果是一个nameserver,直接写一个地址即可
namesrvAddr=172.16.230.21:9876;172.16.230.22:9876;172.16.230.23:9876
brokerName=borker-b
brokerClusterName=DefaultCluster
brokerId=0
brokerPermission=6
#在发送消息时,自动创建服务器不存在的topic,默认创建的队列数
defaultTopicQueueNums=4
#是否允许 Broker 自动创建Topic,建议线下开启,线上关闭
autoCreateTopicEnable=true
clusterTopicEnable=true
brokerTopicEnable=true
#是否允许 Broker 自动创建订阅组,建议线下开启,线上关闭
autoCreateSubscriptionGroup=true
sendMessageThreadPoolNums=1
pullMessageThreadPoolNums=20
queryMessageThreadPoolNums=10
adminBrokerThreadPoolNums=16
clientManageThreadPoolNums=32
consumerManageThreadPoolNums=32
heartbeatThreadPoolNums=2
endTransactionThreadPoolNums=12
flushConsumerOffsetInterval=5000
flushConsumerOffsetHistoryInterval=60000
rejectTransactionMessage=false
fetchNamesrvAddrByAddressServer=false
sendThreadPoolQueueCapacity=10000
pullThreadPoolQueueCapacity=100000
queryThreadPoolQueueCapacity=20000
clientManagerThreadPoolQueueCapacity=1000000
consumerManagerThreadPoolQueueCapacity=1000000
heartbeatThreadPoolQueueCapacity=50000
endTransactionPoolQueueCapacity=100000
filterServerNums=0
longPollingEnable=true
shortPollingTimeMills=1000
notifyConsumerIdsChangedEnable=true
highSpeedMode=false
commercialEnable=true
commercialTimerCount=1
commercialTransCount=1
commercialBigCount=1
commercialBaseCount=1
transferMsgByHeap=true
maxDelayTime=40
regionId=DefaultRegion
registerBrokerTimeoutMills=6000
slaveReadEnable=false
disableConsumeIfConsumerReadSlowly=false
consumerFallbehindThreshold=17179869184
brokerFastFailureEnable=true
waitTimeMillsInSendQueue=200
waitTimeMillsInPullQueue=5000
waitTimeMillsInHeartbeatQueue=31000
waitTimeMillsInTransactionQueue=3000
startAcceptSendRequestTimeStamp=0
traceOn=true
enableCalcFilterBitMap=false
expectConsumerNumUseFilter=32
maxErrorRateOfBloomFilter=20
filterDataCleanTimeSpan=86400000
filterSupportRetry=false
enablePropertyFilter=false
compressedRegister=false
forceRegister=true
registerNameServerPeriod=30000
transactionTimeOut=6000
transactionCheckMax=15
transactionCheckInterval=60000
#Broker 对外服务的监听端口
listenPort=10911
serverWorkerThreads=8
serverCallbackExecutorThreads=0
serverSelectorThreads=3
serverOnewaySemaphoreValue=256
serverAsyncSemaphoreValue=64
serverChannelMaxIdleTimeSeconds=120
serverSocketSndBufSize=131072
serverSocketRcvBufSize=131072
serverPooledByteBufAllocatorEnable=true
useEpollNativeSelector=false
clientWorkerThreads=4
clientCallbackExecutorThreads=2
clientOnewaySemaphoreValue=65535
clientAsyncSemaphoreValue=65535
connectTimeoutMillis=3000
channelNotActiveInterval=60000
clientChannelMaxIdleTimeSeconds=120
clientSocketSndBufSize=131072
clientSocketRcvBufSize=131072
clientPooledByteBufAllocatorEnable=false
clientCloseSocketIfTimeout=false
useTLS=false
storePathRootDir=/data/rocketmq/store
storePathCommitLog=/root/rocketmq/store/commitlog
#commitLog每个文件的大小默认1G
mapedFileSizeCommitLog=1073741824
#ConsumeQueue每个文件默认存60W条,根据业务情况调整,
mapedFileSizeConsumeQueue=3000000
enableConsumeQueueExt=false
mappedFileSizeConsumeQueueExt=50331648
bitMapLengthConsumeQueueExt=64
flushIntervalCommitLog=500
commitIntervalCommitLog=200
useReentrantLockWhenPutMessage=false
flushCommitLogTimed=false
flushIntervalConsumeQueue=1000
cleanResourceInterval=10000
deleteCommitLogFilesInterval=100
deleteConsumeQueueFilesInterval=100
destroyMapedFileIntervalForcibly=120000
redeleteHangedFileInterval=120000
#删除文件时间点,默认凌晨 2点
deleteWhen=02
#检测物理文件磁盘空间
diskMaxUsedSpaceRatio=75
#文件保留时间,默认 72 小时
fileReservedTime=128
putMsgIndexHightWater=600000
#限制的消息大小
maxMessageSize=65536
checkCRCOnRecover=true
flushCommitLogLeastPages=4
commitCommitLogLeastPages=4
flushLeastPagesWhenWarmMapedFile=4096
flushConsumeQueueLeastPages=2
flushCommitLogThoroughInterval=10000
commitCommitLogThoroughInterval=200
flushConsumeQueueThoroughInterval=60000
maxTransferBytesOnMessageInMemory=262144
maxTransferCountOnMessageInMemory=32
maxTransferBytesOnMessageInDisk=65536
maxTransferCountOnMessageInDisk=8
accessMessageInMemoryMaxRatio=40
messageIndexEnable=true
maxHashSlotNum=5000000
maxIndexNum=20000000
maxMsgsNumBatch=64
messageIndexSafe=false
haListenPort=10912
haSendHeartbeatInterval=5000
haHousekeepingInterval=20000
haTransferBatchSize=32768
haMasterAddress=
haSlaveFallbehindMax=268435456
brokerRole=ASYNC_MASTER
flushDiskType=ASYNC_FLUSH
syncFlushTimeout=5000
messageDelayLevel=1s 5s 10s 30s 1m 2m 3m 4m 5m 6m 7m 8m 9m 10m 20m 30m 1h 2h
flushDelayOffsetInterval=10000
cleanFileForciblyEnable=true
warmMapedFileEnable=false
offsetCheckInSlave=false
debugLockEnable=false
duplicationEnable=false
diskFallRecorded=true
osPageCacheBusyTimeOutMills=1000
defaultQueryMaxNum=32
transientStorePoolEnable=false
transientStorePoolSize=5
fastFailIfNoBufferInStorePool=false

####  如果要实现双主双从#########

################################################

修改日志保存路径 /data/rocketmq/conf/ 中的xml文件

sed -i 's#${user.home}#/data/rocketmq/logs#g' *.xml

新建日志目录,消息存储路径

[root@rocketmq1 conf]#mkdir -p /data/rocketmq/store
[root@rocketmq1 conf]#mkdir -p /data/rocketmq/store/commitlog
[root@rocketmq1 conf]#mkdir -p /data/rocketmq/logs

修改nameserver初始堆参数

[root@rocketmq1 conf]# vim /data/rocketmq/bin/runserver.sh

修改broker 初始化堆参数

[root@rocketmq1 conf]# vim /data/rocketmq/bin/runbroker.sh

启动nameserver 和 broker进程

[root@rocketmq1 conf]# cd /data/rocketmq/bin/

#启动nameserver
[root@rocketmq1 bin]# nohup ./mqnamesrv & 查看监听端口
[root@rocketmq1 bin]# netstat -anpt | grep java
tcp6 ::: :::* LISTEN /java 查看日志:
[root@rocketmq1 bin]# tail -f /data/rocketmq/logs/rocketmqlogs/namesrv.log
-- :: INFO main - The Name Server boot success. serializeType=JSON #启动 broker
[root@rocketmq1 bin]# nohup ./mqbroker -c /data/rocketmq/conf/2m-noslave/broker-a.properties >/dev/null >& & 监听10911端口
[root@rocketmq1 bin]# netstat -anpt | grep java
tcp6 ::: :::* LISTEN /java
tcp6 ::: :::* LISTEN /java
tcp6 ::: :::* LISTEN /java
tcp6 ::: :::* LISTEN /java
tcp6 172.16.230.21: 172.16.230.21: ESTABLISHED /java
tcp6 172.16.230.21: 172.16.230.21: ESTABLISHED /java

查看集群状态

[root@rocketmq1 bin]# sh mqadmin clusterList -n "172.16.230.21:9876";
Java HotSpot(TM) -Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Java HotSpot(TM) -Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
#Cluster Name #Broker Name #BID #Addr #Version #InTPS(LOAD) #OutTPS(LOAD) #PCWait(ms) #Hour #SPACE
DefaultCluster borker-a 172.16.230.21: V4_3_2 0.00(,0ms) 0.00(,0ms) 429248.92 -1.0000

rocketmq 集群监控

git clone https://github.com/apache/incubator-rocketmq-externals/tree/master/rocketmq-console

编译 rocketmq-console jar包

[root@localhost data]# ls
jdk maven rocketmq-console-ng-1.0..jar rocketmq-externals
[root@localhost data]# cd rocketmq-externals/
[root@localhost rocketmq-externals]# ls
dev rocketmq-console rocketmq-flink rocketmq-go rocketmq-iot-bridge rocketmq-mysql rocketmq-python rocketmq-sentinel rocketmq-spark
README.md rocketmq-docker rocketmq-flume rocketmq-hbase rocketmq-jms rocketmq-php rocketmq-redis rocketmq-serializer

[root@localhost rocketmq-externals]# cd rocketmq-console/ #修改nameserver 地址
[root@localhost rocketmq-externals]# vim src/main/resources/application.properties/

[root@localhost rocketmq-console]# ls
doc LICENSE NOTICE pom.xml README.md src style
[root@localhost rocketmq-console]# mvn clear package -Dmaven.test.skip=true
[root@localhost rocketmq-console]# cp target/rocketmq-console-ng-1.0.0.jar   /data
[root@localhost rocketmq-console]#  cd /data/
[root@localhost rocketmq-console]#  jar -jar  rocketmq-console-ng-1.0.0.jar

压力测试:

[root@harbor benchmark]# export NAMESRV_ADDR=localhost:
[root@harbor benchmark]# cd /opt/senyint/rocketmq-all/benchmark
[root@harbor benchmark]# ./producer.sh

rocketmq 多master集群部署的更多相关文章

  1. RocketMQ(2)---Docker集群部署RocketMQ

    RocketMQ(2)-Docker集群部署RocketMQ =前言= 1.因为自己只买了一台阿里云服务器,所以RocketMQ集群都部署在单台服务器上只是端口不同,如果实际开发,可以分别部署在多台服 ...

  2. rocketmq高可用集群部署(RocketMQ-on-DLedger Group)

    rocketmq高可用集群部署(RocketMQ-on-DLedger Group) rocketmq部署架构 rocketmq部署架构非常多,都是为了解决一些问题,越来越高可用,越来越复杂. 单ma ...

  3. k8s 组件介绍__单Master集群部署

    参考链接:https://github.com/opsnull/follow-me-install-kubernetes-cluster kubernetes 概述 1.kubernetes 是什么 ...

  4. 使用kubeadm进行单master(single master)和高可用(HA)kubernetes集群部署

    kubeadm部署k8s 使用kubeadm进行k8s的部署主要分为以下几个步骤: 环境预装: 主要安装docker.kubeadm等相关工具. 集群部署: 集群部署分为single master(单 ...

  5. 二进制搭建kubernetes-1.18.6单master集群

    master组件 kube-apiserver kubernetes API集群的同一入口,各组件协调者,以RESTful API提供接口服务,所有对象资源的增删改查和监听操作都交给APIserver ...

  6. RocketMQ集群部署记录

    RocketMQ集群部署记录 #引用    https://cloud.tencent.com/developer/article/1147765         一.RocketMQ基础知识介绍 A ...

  7. RocketMQ初探(五)之RocketMQ4.2.6集群部署(单Master+双Master+2m+2s+async异步复制)

    以下部署方式结合众多博友的博客,经过自己一步一步实际搭建,如有雷同,侵权行为,请见谅...其中遇到不少的坑,希望能帮到更多的人,现在很少能找到一份完整版4.2.6版本的搭建教程了,如果你有幸遇见,那么 ...

  8. RocketMQ 简单梳理 及 集群部署笔记【转】

    一.RocketMQ 基础知识介绍Apache RocketMQ是阿里开源的一款高性能.高吞吐量.队列模型的消息中间件的分布式消息中间件. 上图是一个典型的消息中间件收发消息的模型,RocketMQ也 ...

  9. RocketMQ 简单梳理 及 集群部署笔记

    一.RocketMQ 基础知识介绍Apache RocketMQ是阿里开源的一款高性能.高吞吐量.队列模型的消息中间件的分布式消息中间件. 上图是一个典型的消息中间件收发消息的模型,RocketMQ也 ...

随机推荐

  1. C++ QT中自定义控件的简单创建

    为了给控件添加自定义的方法以及重绘控件,我们需要自定义控件来达到自己希望的结果,网上的自定义控件文章比较少,并且过程比较粗略. 此教程以中文版的QT Creator进行介绍 首先我们创建一个新的项目, ...

  2. 部署DTCMS到Jexus遇到的问题及解决思路---部署

    上一篇我们环境已经准备完成,此时可以部署了,我们就以dtcms作为例子,http://bbs.dtcms.net/forum.php?mod=viewthread&tid=2420&e ...

  3. Asp.Net初学小结

    第一章   1.搭建Asp.net开发环境   1).net FrameWork(VS) 2)IIS(xp:5.1,2003:6.0,vista:70,win7:7.5) C:\Windows\Mic ...

  4. 转STM32官方固件库简介

    ST(意法半导体)为了方便用户开发程序,提供了一套丰富的 STM32 固件库.固件库就是函数的集合,固件库函数的作用是向下负责与寄存器直接打交道,向上提供用户函数调用的接口(API) .固件库将这些寄 ...

  5. JDK动态代理与CGLib动态代理相关问题

    导读: 1.JDK动态代理原理是什么?为什么不支持类的代理? 2.JDK动态代理实例 3.CGLib代理原理是什么? 4.CGLib代理实例 5.JDK动态代理与CGLib代理的区别是什么? 6.总结 ...

  6. html5新特性学习笔记

    1.语义化标签兼容问题(语义化标签只支持ie8以上,不包括ie8) 解决方法一:该标签的css中加上display:block; 通过DOM的方式创建这个标签 document.createEleme ...

  7. php7.27: export excel from mysql

    https://stackoverflow.com/questions/15699301/export-mysql-data-to-excel-in-php https://github.com/PH ...

  8. 2017-11-26 编程语言试验之Antlr4+Java实现"圈2"

    "中文编程"知乎专栏原文 此文涉及的源码版本: program-in-chinese/quan2 声明 代码来源 How to Create Language Using Antl ...

  9. Loadrunner 脚本录制-通过代理录制脚本

    脚本录制-通过代理录制脚本 by:授客 QQ:1033553122 版本:Loadruner 11.0 A.PC端录制Web应用程序 步骤1:根据实际情况,选择对应的协议 本例中选择Web(HTTP/ ...

  10. 《InsideC#》笔记(十) 异常处理

    CLR的作用之一是处理异常.通过自动的内存和资源管理可以避免一部分异常,然后借助强类型系统还可以捕获运行时异常. 一 异常基础 异常处理系统保护四个关键字:try,catch,throw,finall ...