本文主要记录通过docker搭建rockmq集群版
docker run --name=broker-master1 --net=host -d -v /etc/localtime:/etc/localtime:ro -v /data/broker-master1/logs:/var/app/logs:rw -v /data/broker-master1/conf/broker.conf:/etc/rocketmq/broker.conf -e "JAVA_OPT_EXT=-server -Xms2G -Xmx2G -Xmn1G" -e "JAVA_OPTS=-Duser.home=/opt" -e "MAX_POSSIBLE_HEAP=300000000" rocketmqinc/rocketmq:4.4.0 sh mqbroker -c /etc/rocketmq/broker.conf
vim /data/broker-master1/conf/broker.conf
brokerClusterName=4D_pro_mq
brokerName=broker-a
brokerIP1 = 192.168.2.11
brokerId=0
deleteWhen=04
fileReservedTime=168
brokerRole=ASYNC_MASTER
flushDiskType=ASYNC_FLUSH
listenPort = 10911
namesrvAddr=192.168.2.11:9876;192.168.2.12:9876
autoCreateTopicEnable=true
sendMessageThreadPoolNums=128
useReentrantLockWhenPutMessage=true
docker run --name=broker-slave1 --net=host -d -v /etc/localtime:/etc/localtime:ro -v /data/broker-slave1/logs:/var/app/logs:rw -v /data/broker-slave1/conf/broker.conf:/etc/rocketmq/broker.conf -e "JAVA_OPT_EXT=-server -Xms2G -Xmx2G -Xmn1G" -e "JAVA_OPTS=-Duser.home=/opt" -e "MAX_POSSIBLE_HEAP=300000000" rocketmqinc/rocketmq:4.4.0 sh mqbroker -c /etc/rocketmq/broker.conf
vim /data/broker-slave1/conf/broker.conf
brokerClusterName=4D_pro_mq
brokerName=broker-a
brokerIP1 = 192.168.2.11
brokerId=1
deleteWhen=04
fileReservedTime=168
brokerRole=SLAVE
flushDiskType=ASYNC_FLUSH
listenPort = 11011
namesrvAddr=192.168.2.11:9876;192.168.2.12:9876
autoCreateTopicEnable=true
sendMessageThreadPoolNums=128
useReentrantLockWhenPutMessage=true
docker run --name=broker-master2 --net=host -d -v /etc/localtime:/etc/localtime:ro -v /data/broker-master2/logs:/var/app/logs:rw -v /data/broker-master2/conf/broker.conf:/etc/rocketmq/broker.conf -e "JAVA_OPT_EXT=-server -Xms2G -Xmx2G -Xmn1G" -e "JAVA_OPTS=-Duser.home=/opt" -e "MAX_POSSIBLE_HEAP=300000000" rocketmqinc/rocketmq:4.4.0 sh mqbroker -c /etc/rocketmq/broker.conf
vim /data/broker-master2/conf/broker.conf
brokerClusterName=4D_pro_mq
brokerName=broker-b
brokerIP1 = 192.168.2.12
brokerId=0
deleteWhen=04
fileReservedTime=168
brokerRole=ASYNC_MASTER
flushDiskType=ASYNC_FLUSH
listenPort = 10911
namesrvAddr=192.168.2.11:9876;192.168.2.12:9876
autoCreateTopicEnable=true
sendMessageThreadPoolNums=128
useReentrantLockWhenPutMessage=true
docker run --name=broker-slave2 --net=host -d -v /etc/localtime:/etc/localtime:ro -v /data/broker-slave2/logs:/var/app/logs:rw -v /data/broker-slave2/conf/broker.conf:/etc/rocketmq/broker.conf -e "JAVA_OPT_EXT=-server -Xms2G -Xmx2G -Xmn1G" -e "JAVA_OPTS=-Duser.home=/opt" -e "MAX_POSSIBLE_HEAP=300000000" rocketmqinc/rocketmq:4.4.0 sh mqbroker -c /etc/rocketmq/broker.conf
vim /data/broker-slave2/conf/broker.conf
brokerClusterName=4D_pro_mq
brokerName=broker-b
brokerIP1 = 192.168.2.12
brokerId=1
deleteWhen=04
fileReservedTime=168
brokerRole=SLAVE
flushDiskType=ASYNC_FLUSH
listenPort = 11011
namesrvAddr=192.168.2.11:9876;192.168.2.12:9876
autoCreateTopicEnable=true
sendMessageThreadPoolNums=128
useReentrantLockWhenPutMessage=true
两台分别执行
docker run --net=host --name=namesrv-1 -v /etc/localtime:/etc/localtime:ro -v /data/namesrv-1/logs:/var/app/logs:rw -e "JAVA_OPT_EXT=-server -Xms512m -Xmx512m -Xmn512m" -e "JAVA_OPTS=-Duser.home=/opt" -e "MAX_POSSIBLE_HEAP=200000000" -d rocketmqinc/rocketmq:4.4.0 sh mqnamesrv
docker run --net=host --name=namesrv-2 -v /etc/localtime:/etc/localtime:ro -v /data/namesrv-1/logs:/var/app/logs:rw -e "JAVA_OPT_EXT=-server -Xms512m -Xmx512m -Xmn512m" -e "JAVA_OPTS=-Duser.home=/opt" -e "MAX_POSSIBLE_HEAP=200000000" -d rocketmqinc/rocketmq:4.4.0 sh mqnamesrv
docker run -d --name=rmqconsle -e "JAVA_OPTS=-Drocketmq.namesrv.addr=192.168.2.11:9876;192.168.2.12:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=false" -p 8080:8080 -t styletang/rocketmq-console-ng