RocketMQ
构建docker镜像
git clone https://github.com/apache/rocketmq-docker.git
cd rocketmq-docker/image-build/
sh build-image.sh RMQ-VERSION BASE-IMAGE
注意:
1、RMQ-VERSION可以是任何已经发布的RocketMQ版本,查看发布版本
2、BASE-IMAGE支持centos, alpine
// 构建docker镜像
sh build-image.sh 4.9.2 alpine
// docker镜像打标签
docker tag 2e25d8496557 xxxxx.com/apacherocketmq/rocketmq:4.9.2-alpine
// 推送到私有仓库
docker push xxxxx.com/apacherocketmq/rocketmq:4.9.2-alpine
生成执行脚本
sh stage.sh RMQ-VERSION
注意:RMQ-VERSION 是 RocketMQ 镜像的标签。执行上述shell脚本后,(例如sh stage.sh 4.9.2),会生成一个stage目录(./stages/4.9.2)。假设RMQ-version定义为4.9.2,用户可以在该目录下进行以下工作。
启动RocketMQ【单节点】
cd stages/4.9.2/templates/
./play-docker.sh alpine
验证 RocketMQ 是否工作正常
// 查找broker容器
docker ps|grep rmqbroker
//docker exec -it {container_id} ./mqadmin clusterList -n {nameserver_ip}:9876
docker exec -it b72fc31ae94b ./mqadmin clusterList -n 192.168.43.56:9876
ocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.InternalThreadLocalMap).
RocketMQLog:WARN Please initialize the logger system properly.
#Cluster Name #Broker Name #BID #Addr
#Version #InTPS(LOAD) #OutTPS(LOAD) #PCWait(ms) #Hour #SPACE
DefaultCluster b72fc31ae94b 0 172.17.0.5:10911
V4_9_2 0.00(0,0ms) 0.00(0,0ms) 0 454971.19 0.0500
自定义配置
首先,修改stages/4.9.2/templates/data/broker/conf/broker.conf
,如下所示:
brokerClusterName = DefaultCluster
brokerName = broker-a
brokerId = 0
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
#设置物理ip地址
brokerIP1=10.10.101.80
调整play-docker.sh配置
#Start Broker
docker run -d -v `pwd`/data/broker/logs:/home/rocketmq/logs -v `pwd`/data/broker/store:/home/rocketmq/store -v `pwd`/data/broker/conf/broker.conf:/home/rocketmq/rocketmq-4.9.2/conf/broker.conf --name rmqbroker --link rmqnamesrv:namesrv -e "NAMESRV_ADDR=namesrv:9876" -p 10909:10909 -p 10911:10911 -p 10912:10912 apacherocketmq/rocketmq:4.9.2${TAG_SUFFIX} sh mqbroker -c /home/rocketmq/rocketmq-4.9.2/conf/broker.conf
重新启动RocketMQ
RocketMQ Dashboard
构建docker镜像
cd image-build/
// 构建docker镜像
sh build-image-dashboard.sh 1.0.0 centos
// docker镜像打标签
docker tag 5775568c4fe2 xxxxx.com/apacherocketmq/rocketmq-dashboard:1.0.0-centos
// 推送到私有仓库
docker push xxxxx.com/apacherocketmq/rocketmq-dashboard:1.0.0-centos
启动Dashboard
cd product
sh start-dashboard.sh 1.0.0
配置Dashboard
- 打开Dashboard:http://192.168.43.56:6765/
- 配置NameServerAddress:运维 -》NameServerAddressList,输入:192.168.43.56:9876