使用Docker容器部署rocketmq单机的全过程

本站所有内容来自互联网收集,仅供学习和交流,请勿用于商业用途。如有侵权、不妥之处,请第一时间联系我们删除!Q群:迪思分享

免费资源网 – https://freexyz.cn/
目录查询镜像拉取镜像创建namesrv数据存储路径构建namesrv容器创建broker数据存储路径创建broker配置文件broker.conf 内容如下:构建broker容器构建rocketmq-console-ng

查询镜像

docker search rocketmq NAME DESCRIPTION STARS OFFICIAL AUTOMATED foxiswho/rocketmq rocketmq 69 rocketmqinc/rocketmq Image repository for Apache RocketMQ 54 styletang/rocketmq-console-ng rocketmq-console-ng 37 apacherocketmq/rocketmq Docker Image for Apache RocketMQ 21 apache/rocketmq

拉取镜像

docker pull foxiswho/rocketmq:server #mq-server … docker pull foxiswho/rocketmq:broker #mq-broker … docker pull styletang/rocketmq-console-ng #客户端 …

创建namesrv数据存储路径

mkdir -p /var/local/docker/rocketmq/namesrv/store /var/log/docker/rocketmq/namesrv

构建namesrv容器

docker run -d –restart=always –name rmqnamesrv -p 9876:9876 -v /var/log/docker/rocketmq/namesrv:/var/log -v /var/local/docker/rocketmq/namesrv/store:/var/store -e “MAX_POSSIBLE_HEAP=100000000” foxiswho/rocketmq sh mqnamesrv

创建broker数据存储路径

mkdir -p /var/local/docker/rocketmq/broker/store /var/log/docker/rocketmq/broker

创建broker配置文件

mkdir -p /etc/docker/rocketmq/conf touch broker.conf vi broker.conf

broker.conf 内容如下:

vim /docker/rocketmq/conf/broker.conf # 所属集群名称,如果节点较多可以配置多个 brokerClusterName = DefaultCluster #broker名称,master和slave使用相同的名称,表明他们的主从关系 brokerName = broker-a #0表示Master,大于0表示不同的slave brokerId = 0 #表示几点做消息删除动作,默认是凌晨4点 deleteWhen = 04 #在磁盘上保留消息的时长,单位是小时 fileReservedTime = 48 #有三个值:SYNC_MASTER,ASYNC_MASTER,SLAVE;同步和异步表示Master和Slave之间同步数据的机制; brokerRole = ASYNC_MASTER #刷盘策略,取值为:ASYNC_FLUSH,SYNC_FLUSH表示同步刷盘和异步刷盘;SYNC_FLUSH消息写入磁盘后才返回成功状态,ASYNC_FLUSH不需要; flushDiskType = ASYNC_FLUSH # 设置broker节点所在服务器的ip地址 brokerIP1 = 192.168.1.1 # 注意:改成你的IP地址

构建broker容器

docker run -d –restart=always –name rmqbroker –link rmqnamesrv:namesrv -p 10911:10911 -p 10909:10909 -v /var/local/docker/rocketmq/broker/store:/var/store -v /var/log/docker/rocketmq/broker:/var/logs -v /etc/docker/rocketmq/conf/broker.conf:/etc/rocketmq/conf/broker.conf -e “NAMESRV_ADDR=namesrv:9876” -e “MAX_POSSIBLE_HEAP=200000000” foxiswho/rocketmq:broker sh mqbroker -c /etc/rocketmq/conf/broker.conf

构建rocketmq-console-ng

docker run -d –name rmqconsole -p 8180:8080 –restart=always –link rmqserver:namesrv -e “JAVA_OPTS=-Drocketmq.namesrv.addr=namesrv:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=false” -t styletang/rocketmq-console-ng
免费资源网 – https://freexyz.cn/


© 版权声明
THE END
★喜欢这篇文章吗?喜欢的话,麻烦动动手指支持一下!★
点赞8 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容