docker 安裝 rocketmq 4.7.0
1、下載
直接克隆官方映象製作檔案
# git clone https://github.com/apache/rocketmq-docker.git
[root@localhost rocketmq-docker-master]# ls
CONTRIBUTING.md image-build LICENSE NOTICE product README.md stages stage.sh templates
[root@localhost rocketmq-docker-master]# cd image-build/
[root@localhost image-build]# ls
build-image-dashboard.sh build-image.sh Dockerfile-alpine Dockerfile-centos Dockerfile-centos-dashboard scripts update.sh
2、建立RocketMQ映象
構建命令:sh build-image.sh RMQ-VERSION BASE-IMAGE
可選RMQ-VERSION
例如: shbuild-image.sh 4.7.0 centos (or alpine)
構建時間比較長
//構建完成
Successfully built 128108c2e50d
Successfully tagged apacherocketmq/rocketmq:4.7.1-alpine
[root@localhost image-build]# docker images |grep mq
apacherocketmq/rocketmq 4.7.0 28ce832d84bf 59 minutes ago 533MB
3、生成配置
[root@localhost rocketmq-docker-master]# sh stage.sh 4.7.0
Stage version = 4.7.0
mkdir /root/rocketmq-docker-master/stages/4.7.0
staged templates into folder /root/rocketmq-docker-master/stages/4.7.0
[root@localhost templates]# ls
data docker-compose kubernetes play-consumer.sh play-docker-compose.sh play-docker-dledger.sh play-docker.sh play-docker-tls.sh play-kubernetes.sh play-producer.sh ssl
4、部署方式
1、單機
./play-docker.sh alpine
2、docker-composer
./play-docker-compose.sh
3、kubernetes叢集
./play-kubernetes.sh
4、Cluster of Dledger storage(RocketMQ需要4.4.0版本以上)
./play-docker-dledger.sh
5、TLS
./play-docker-tls.sh
./play-producer.sh
./play-consumer.sh
我這裡選擇的是單機部署,可以看到生成了兩個容器
[root@localhost templates]# docker ps |grep mq
9a0a6ab594b7 apacherocketmq/rocketmq:4.7.0 "sh mqbroker" 56 minutes ago Up 56 minutes 0.0.0.0:10909->10909/tcp, :::10909->10909/tcp, 9876/tcp, 0.0.0.0:10911-10912->10911-10912/tcp, :::1091110912->10911-10912/tcp rmqbroker
d8a4db8335de apacherocketmq/rocketmq:4.7.0 "sh mqnamesrv" 56 minutes ago Up 56 minutes 10909/tcp, 0.0.0.0:9876->9876/tcp, :::9876->9876/tcp, 10911-10912/tcp rmqnamesrv
驗證RocketMQ啟動成功
1、使用命令docker ps|grep rmqbroker
找到RocketMQ broker的容器id
2、使用命令docker exec -it 9a0a6ab594b7 ./mqadmin clusterList -n 172.17.0.8:9876
驗證RocketMQ broker工作正常
[root@localhost elasticsearch]# docker exec -it 9a0a6ab594b7 ./mqadmin clusterList -n 192.168.1.204:9876
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
如需升級執行以下命令
cd image-build
./update.sh
5、安裝RocketMQ控制檯
//拉取映象
docker pull apacherocketmq/rocketmq-console:2.0.0
//執行容器,這裡172.15.65.xx為宿主機ip
docker run -e "JAVA_OPTS=-Drocketmq.namesrv.addr=172.15.65.xx:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=false" -p 6881:8080 -t apacherocketmq/rocketmq-console:2.0.0