Posted in Servers onApril 03, 2022
目录
查询镜像
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
到此这篇关于使用Docker容器部署rocketmq单机的文章就介绍到这了,更多相关Docker部署rocketmq内容请搜索三水点靠木以前的文章或继续浏览下面的相关文章希望大家以后多多支持三水点靠木!
使用Docker容器部署rocketmq单机的全过程
- Author -
执意- Original Sources -
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Tags in this post...
Reply on: @reply_date@
@reply_contents@