绿联nas docker 安装 rocketmq 队列。亲测可用

首先拉取docker 镜像,所需镜像如下:

绿联nas docker 安装 rocketmq 队列。亲测可用插图

安装 nameserver

docker run -d -p 9876:9876 \ -v ${HOME}/docker/software/rocketmq/data/namesrv/logs:/opt/logs \ -v ${HOME}/docker/software/rocketmq/data/namesrv/store:/opt/store \ --name rmqnamesrv \ -e "MAX_POSSIBLE_HEAP=100000000" \ foxiswho/rocketmq:server-4.5.1
docker run -d -p 9876:9876 \ -v ${HOME}/docker/software/rocketmq/data/namesrv/logs:/opt/logs \ -v ${HOME}/docker/software/rocketmq/data/namesrv/store:/opt/store \ --name rmqnamesrv \ -e "MAX_POSSIBLE_HEAP=100000000" \ foxiswho/rocketmq:server-4.5.1
docker run -d -p 9876:9876 \ -v ${HOME}/docker/software/rocketmq/data/namesrv/logs:/opt/logs \ -v ${HOME}/docker/software/rocketmq/data/namesrv/store:/opt/store \ --name rmqnamesrv \ -e "MAX_POSSIBLE_HEAP=100000000" \ foxiswho/rocketmq:server-4.5.1

安装 borker

安装 broker 之前,我们需要在本地初始化配置文件,防止项目连接不到 rocketmq

1)新建配置目录

mkdir -p ${HOME}/docker/software/rocketmq/config
mkdir -p ${HOME}/docker/software/rocketmq/config
mkdir -p ${HOME}/docker/software/rocketmq/config

2)新建配置文件 broker.conf

brokerClusterName = DefaultCluster brokerName = <a href="https://www.moluyao.wang/go?_=854401ad46aHR0cHM6Ly96aGlkYS56aGlodS5jb20vc2VhcmNoP2NvbnRlbnRfaWQmIzA2MTsxNzEyMzE3MDMmYW1wO2NvbnRlbnRfdHlwZSYjMDYxO0FydGljbGUmYW1wO21hdGNoX29yZGVyJiMwNjE7MSZhbXA7cSYjMDYxO2Jyb2tlci1hJmFtcDt6aGlkYV9zb3VyY2UmIzA2MTtlbnRpdHk%3D" rel="nofollow noopener noreferrer" title="broker-a" target="_blank">broker-a</a> brokerId = 0 deleteWhen = 04 fileReservedTime = 48 brokerRole = ASYNC_MASTER flushDiskType = ASYNC_FLUSH # 此处为本地ip, 如果公网部署, 需要填写服务器外网ip brokerIP1 = xx.xx.xx.xx 这个ip可以在docker 网络中查看
brokerClusterName = DefaultCluster brokerName = <a href="https://www.moluyao.wang/go?_=854401ad46aHR0cHM6Ly96aGlkYS56aGlodS5jb20vc2VhcmNoP2NvbnRlbnRfaWQmIzA2MTsxNzEyMzE3MDMmYW1wO2NvbnRlbnRfdHlwZSYjMDYxO0FydGljbGUmYW1wO21hdGNoX29yZGVyJiMwNjE7MSZhbXA7cSYjMDYxO2Jyb2tlci1hJmFtcDt6aGlkYV9zb3VyY2UmIzA2MTtlbnRpdHk%3D" rel="nofollow noopener noreferrer" title="broker-a" target="_blank">broker-a</a> brokerId = 0 deleteWhen = 04 fileReservedTime = 48 brokerRole = ASYNC_MASTER flushDiskType = ASYNC_FLUSH # 此处为本地ip, 如果公网部署, 需要填写服务器外网ip brokerIP1 = xx.xx.xx.xx 这个ip可以在docker 网络中查看
brokerClusterName = DefaultCluster brokerName = broker-a brokerId = 0 deleteWhen = 04 fileReservedTime = 48 brokerRole = ASYNC_MASTER flushDiskType = ASYNC_FLUSH # 此处为本地ip, 如果公网部署, 需要填写服务器外网ip brokerIP1 = xx.xx.xx.xx 这个ip可以在docker 网络中查看

brokerIP1 这个用broker 网络里面的ip

绿联nas docker 安装 rocketmq 队列。亲测可用插图1

最后执行创建 broker 容器命令,命令虽然比较长,但是职责比较单一

  • 宿主机 10911、10909 和容器做一个映射
  • 给 broker 起一个新的名字 rmqbroker
  • 关联 rmqnamesrv 并起一个别名 namesrv 用作 namesrv 地址 ip
  • 修改启动内存为 512 m
docker run -d \ -p 10911:10911 \ -p 10909:10909 \ --name rmqbroker \ --link rmqnamesrv:namesrv \ -v ${HOME}/docker/software/rocketmq/conf/broker.conf:/etc/rocketmq/broker.conf \ -e "NAMESRV_ADDR=namesrv:9876" \ -e "JAVA_OPTS=-Duser.home=/opt" \ -e "JAVA_OPT_EXT=-server -Xms512m -Xmx512m" \ foxiswho/rocketmq:broker-4.5.1
docker run -d \ -p 10911:10911 \ -p 10909:10909 \ --name rmqbroker \ --link rmqnamesrv:namesrv \ -v ${HOME}/docker/software/rocketmq/conf/broker.conf:/etc/rocketmq/broker.conf \ -e "NAMESRV_ADDR=namesrv:9876" \ -e "JAVA_OPTS=-Duser.home=/opt" \ -e "JAVA_OPT_EXT=-server -Xms512m -Xmx512m" \ foxiswho/rocketmq:broker-4.5.1
docker run -d \ -p 10911:10911 \ -p 10909:10909 \ --name rmqbroker \ --link rmqnamesrv:namesrv \ -v ${HOME}/docker/software/rocketmq/conf/broker.conf:/etc/rocketmq/broker.conf \ -e "NAMESRV_ADDR=namesrv:9876" \ -e "JAVA_OPTS=-Duser.home=/opt" \ -e "JAVA_OPT_EXT=-server -Xms512m -Xmx512m" \ foxiswho/rocketmq:broker-4.5.1

其中namesrv 换成nameserver 的局域网ip,如:192.168.1.111

绿联nas docker 安装 rocketmq 队列。亲测可用插图2安装 控制台

docker run -d \ --link rmqnamesrv:namesrv \ -e "JAVA_OPTS=-Drocketmq.config.namesrvAddr=namesrv:9876 -Drocketmq.config.isVIPChannel=false" \ --name rmqconsole \ -p 8088:8080 \ -t pangliang/rocketmq-console-ng
docker run -d \ --link rmqnamesrv:namesrv \ -e "JAVA_OPTS=-Drocketmq.config.namesrvAddr=namesrv:9876 -Drocketmq.config.isVIPChannel=false" \ --name rmqconsole \ -p 8088:8080 \ -t pangliang/rocketmq-console-ng
docker run -d \ --link rmqnamesrv:namesrv \ -e "JAVA_OPTS=-Drocketmq.config.namesrvAddr=namesrv:9876 -Drocketmq.config.isVIPChannel=false" \ --name rmqconsole \ -p 8088:8080 \ -t pangliang/rocketmq-console-ng

JAVA_OPTS=-Drocketmq.config.namesrvAddr=namesrv:9876 其中namesrv 换成nameserver 的局域网ip,如:192.168.1.111

原文链接:https://blog.csdn.net/yuanshiren133/article/details/145676096?ops_request_misc=%257B%2522request%255Fid%2522%253A%25229da32878f6edd7d3a9abce7792d84238%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=9da32878f6edd7d3a9abce7792d84238&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~times_rank-18-145676096-null-null.nonecase&utm_term=%E7%BB%BF%E8%81%94nas

© 版权声明
THE END
喜欢就支持一下吧
点赞10 分享