注意:没有docker环境的可以参考本人的centos安装docker
1.查询有哪些可以用的rocketMq
docker search rocketmq
2.拉取镜像
docker pull rocketmqinc/rocketmq
docker pull apache/rocketmq:4.9.6(官方漏洞修复版本)
3.启动namesrv服务(新建文件路径我的是/www/mq)

docker run -d -p 9876:9876 -v /www/mq/data/namesrv/logs:/root/logs -v /www/mq/data/namesrv/store:/root/store --name rmqnamesrv -e "JAVA_OPTS=-Duser.home=/opt" -e "JAVA_OPT_EXT=-server -Xms1024m -Xmx1024m" rocketmqinc/rocketmq sh mqnamesrv 

4.配置

brokerClusterName = DefaultCluster
brokerName = broker-a
brokerId = 0
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
#换成网络IP
namesrvAddr = 127.0.0.1:9876
#换成网络IP
brokerIP1 = 127.0.0.1
#是否允许 Broker 自动创建Topic,建议线下开启,线上关闭 
autoCreateTopicEnable=true
#是否允许 Broker 自动创建订阅组,建议线下开启,线上关闭 
autoCreateSubscriptionGroup=true

5.启动服务

docker run -d  -p 10911:10911 -p 10909:10909   -v /www/mq/data/broker/logs:/root/logs -v /www/mq/rocketmq/data/broker/store:/root/store  -v /www/mq/conf/broker.conf:/opt/rocketmq/conf/broker.conf  --name rmqbroker --link rmqnamesrv:namesrv -e "NAMESRV_ADDR=namesrv:9876" -e "JAVA_OPTS=-Duser.home=/opt" -e "JAVA_OPT_EXT=-server -Xms1024m -Xmx1024m"  rocketmqinc/rocketmq sh mqbroker -c /opt/rocketmq/conf/broker.conf

6.安装控制台

docker run -e "JAVA_OPTS=-Drocketmq.config.namesrvAddr=127.0.0.1:9876 -Drocketmq.config.isVIPChannel=false" -p 9993:8080 -t styletang/rocketmq-console-ng

7.进入docker容器命令行
docker exec -it f2f52602d48a /bin/bash


恒不动
105 声望15 粉丝

下一篇 »
Netty