1. 程式人生 > 其它 >Docker 部署RocketMQ

Docker 部署RocketMQ

拉取映象

docker search rocketmq

docker pull foxiswho/rocketmq:4.8.0

啟動NameServer

docker run -d --name rmqnamesrver -e "JAVA_OPT_EXT=-Xms512M -Xmx512M -Xmn128m" -p 9876:9876 foxiswho/rocketmq:4.8.0 sh mqnamesrv

啟動Broker

建立掛在目錄

mkdir -p /data/docker/rocketmq/logs
mkdir -p /data/docker/rocketmq/store
chmod -R 777 /data

啟動broker

docker run -d  -v /data/docker/rocketmq/logs:/home/rocketmq/logs -v    /data/docker/rocketmq/store:/home/rocketmq/store 
      --name rmqbroker 
      -e "NAMESRV_ADDR=[namserver ip地址]:9876" 
      -e ”JAVA_OPT_EXT=-Xms512M -Xmx512M -Xmn128m" 
      -p 10911:10911 
      foxiswho/rocketmq:4.8.0 
      sh mqbroker -c /home/rocketmq/rocketmq-4.8.0/conf/broker.conf

需要注意:sh mqbroker -c 後的路徑是否正確,當啟動後要進入容器在broker.conf中配置上NameServer的ip資訊。將broker註冊進Nameserver。

啟動Rocketmq-console控制檯

docker search rocketmq-console-ng
docker pull rocketmq-console-ng
docker run --name rmqconsole
-e "JAVA_OPTS=-Drocketmq.namesrv.addr=[namserver ip]:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=false"
-p 8180:8080 -t styletang/rocketmq-console-ng

開放埠 fire-cmd --zone=public --add-port=8180/tcp --permanent

瀏覽器訪問:ip地址:8180