本文前提是Linux系统上已经安装了docker环境,且对rocketmq的服务有基本的了解
- 拉取rocketmq镜像
docker pull rocketmqinc/rocketmq:4.4.0
- 创建数据存放目录
cd /usr/local
mkdir rocketmq
cd rocketmq
mkdir data
cd data
mkdir namesrv
cd namesrv
mkdir logs
mkdir store
- 启动namesrv容器
docker run -d -p 9876:9876 -v /usr/local/rocketmq/data/namesrv/logs:/root/logs -v /usr/local/rocketmq/data/namesrv/store:/root/store --name rocketmqnamesrv -e "MAX_POSSIBLE_HEAP=100000000" rocketmqinc/rocketmq:4.4.0 sh mqnamesrv
-
安装broker
-
创建broker.conf文件
cd /usr/local/rocketmq mkdir conf cd conf touch broker.conf vi broker.conf # 添加如下内容 brokerClusterName = DefaultCluster brokerName = broker-a brokerId = 0 deleteWhen = 04 fileReservedTime = 48 brokerRole = ASYNC_MASTER flushDiskType = ASYNC_FLUSH brokerIP1 = IP地址 # 创建完文件后,保存退出
-
添加目录
cd /usr/local/rocketmq/data mkdir broker cd broker mkdir logs mkdir store
-
-
启动broker
docker run -d -p 10911:10911 -p 10909:10909 -v /usr/local/rocketmq/data/broker/logs:/root/logs -v /usr/local/rocketmq/data/broker/store:/root/store -v /usr/local/rocketmq/conf/broker.conf:/opt/rocketmq-4.4.0/conf/broker.conf --name rocketmqbroker --link rocketmqnamesrv:namesrv -e "NAMESRV_ADDR=namesrv:9876" -e "MAX_POSSIBLE_HEAP=200000000" rocketmqinc/rocketmq:4.4.0 sh mqbroker -c /opt/rocketmq-4.4.0/conf/broker.conf
-
安装rocketmq控制台
-
拉取镜像
docker pull styletang/rocketmq-console-ng
-
启动控制台
docker run -e "JAVA_OPTS=-Drocketmq.namesrv.addr=IP地址:9876 - Dcom.rocketmq.sendMessageWithVIPChannel=false" -p 8080:8080 -t styletang/rocketmq-console-ng
-
访问控制台
http://ip:8080
-