docker安装rocketMQ教程
- 拉取镜像
#拉取镜像
docker pull foxiswho/rocketmq:server-4.3.2
docker pull foxiswho/rocketmq:broker-4.3.2
- 创建数据挂载目录
mkdir -p /usr/dockerrocketmq/rmqserver01/logs
mkdir -p /usr/dockerrocketmq/rmqserver01/store
mkdir -p /usr/dockerrocketmq/rmqbroker01/logs
mkdir -p /usr/dockerrocketmq/rmqbroker01/store
mkdir -p /usr/dockerrocketmq/rmqbroker01/conf
- 编辑配置文件(别忘改ip)
namesrvAddr=192.168.130.128:9876
brokerClusterName = DefaultCluster
brokerName = broker-a
brokerId = 0
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
brokerIP1 = 192.168.130.128
listenPort=10911
- 创建容器,启动容器
#创建nameserver容器
docker create -p 9876:9876 --name rmqserver01 -e "JAVA_OPT_EXT=-server -Xms128m -Xmx128m -Xmn128m" -e "JAVA_OPTS=-Duser.home=/opt" -v /usr/dockerrocketmq/rmqserver01/logs:/opt/logs -v /usr/dockerrocketmq/rmqserver01/store:/opt/store foxiswho/rocketmq:server-4.3.2
docker run -it -d --net host --name rmqbroker01 -e "JAVA_OPT_EXT=-server -Xms128m -Xmx128m -Xmn128m" -e "JAVA_OPTS=-Duser.home=/opt" -v /usr/dockerrocketmq/rmqbroker01/conf/broker.conf:/etc/rocketmq/broker.conf -v /usr/dockerrocketmq/rmqbroker01/logs:/opt/logs -v /usr/dockerrocketmq/rmqbroker01/store:/opt/store --privileged=true foxiswho/rocketmq:broker-4.3.2
#启动容器
docker start rmqserver01 rmqbroker01
部署RocketMQ的管理工具
RocketMQ提供了UI管理工具,名为rocketmq-console,我们选择docker安装
#拉取镜像
docker pull styletang/rocketmq-console-ng:1.0.0
#创建并启动容器
docker run -e "JAVA_OPTS=-Drocketmq.namesrv.addr=192.168.130.128:9876;192.168.130.128:9877 -Dcom.rocketmq.sendMessageWithVIPChannel=false" -p 8082:8080 -t styletang/rocketmq-console-ng:1.0.0
通过浏览器进行访问(改ip):http://192.168.130.128:8082/