准备局域网
nameserver和broker在同一网段才能够互相访问,我们先创建一个局域网。
创建rocketmq-network,让nameserver、broker在同一个网段:
docker network create --driver=bridge \
--subnet=192.168.2.10/24 rocketmq-network
安装nameserver
docker run -d \
--restart=always \
--network=rocketmq-network \
--ip=192.168.2.11 \ # 静态ip
--name nameserver \
-p 9876:9876 \ # 暴露端口
-v D:\springcloud\学习\rocketmq\namesrv\data\namesrv\logs:/home/rocketmq/logs \ # 挂载日志
-v D:\springcloud\学习\rocketmq\namesrv\data\namesrv\store:/home/rocketmq/store \ # 挂载数据
-e "JAVA_OPT_EXT=-Xms512M -Xmx512M -Xmn128m" foxiswho/rocketmq:4.8.0 \
sh mqnamesrv
安装broker
docker run -d \
--restart=always \
--network=rocketmq-network \
--ip=192.168.2.21 \
--name rmqbroker \
-p 10911:10911 -p 10909:10909 \
-v D:\springcloud\学习\rocketmq\broker\data\namesrv\logs:/home/rocketmq/logs \
-v D:\springcloud\学习\rocketmq\broker\data\namesrv\store:/home/rocketmq/store \
-v D:\springcloud\学习\rocketmq\broker\data\namesrv\conf\broker.conf:/home/rocketmq/rocketmq-4.8.0/conf/broker.conf \
-e "JAVA_OPT_EXT=-Xms512M -Xmx512M -Xmn128m" \
-e "NAMESRV_ADDR=192.168.2.11:9876" foxiswho/rocketmq:4.8.0 \
sh mqbroker -c /home/rocketmq/rocketmq-4.8.0/conf/broker.conf
安装rocketmq-dashboard面板
docker run -d \--restart=always \--network=rocketmq-network \ --ip=192.168.2.31 \ # 静态ip--name rocketmq-dashboard \ -e "JAVA_OPTS=-Drocketmq.namesrv.addr=192.168.2.11:9876" \ # nameserver地址-p 8080:8080 \ # 对外暴露的网页所在端口-t apacherocketmq/rocketmq-dashboard:latest