公有云安装 rocketmq
一,安装 NameSrv
1,创建 nameSrv 数据挂载文件夹
mkdir -p /usr/data/rocketMQ/data/namesrv/logs
mkdir -p /usr/data/rocketMQ/data/namesrv/store
2,docker search rocketmq
3,选取 star 最多的 rocketmqinc, docker pull docker.io/rocketmqinc/rocketmq
4,启动 namesrv 服务
docker run -d -p 9876:9876 -v /usr/data/rocketMQ/data/namesrv/logs:/root/logs -v /usr/data/rocketMQ/data/namesrv/store:/root/store --name mqnamesrv -e "MAX_POSSIBLE_HEAP=100000000" docker.io/rocketmqinc/rocketmq sh mqnamesrv
二,安装 broker
1,启动 broker 服务
创建 broker 配置文件挂载文件夹
mkdir -p /usr/data/rocketMQ/data/broker/logs
mkdir -p /usr/data/rocketMQ/data/broker/store
mkdir -p /usr/data/rocketMQ/data/broker/conf/
2,新增 broker 配置文件,在 /usr/data/rocketMQ/data/broker/conf 目录下创建 broker.conf 文件,内容如下:
brokerClusterName = DefaultCluster
brokerName = broker-a
brokerId = 0
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
brokerIP1 = 39.97.240.142
3,运行 broker 容器
docker run -d -p 10911:10911 -p 10909:10909 -v /usr/data/rocketMQ/data/broker/logs:/root/logs -v /usr/data/rocketMQ/data/broker/store:/root/store -v /usr/data/rocketMQ/data/broker/conf/broker.conf:/opt/rocketmq-4.4.0/conf/broker.conf --name rmqbroker --link mqnamesrv:mqnamesrv -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
4,安装控制台
docker search rocketmq-console
安装 star 最多的 docker pull styletang/rocketmq-console-ng
7,启动容器
docker run -e "JAVA_OPTS=-Drocketmq.config.namesrvAddr=39.97.240.142:9876 -Drocketmq.config.isVIPChannel=false" -p 8080:8080 -t styletang/rocketmq-console-ng
注意 java_opts 参数因不同的 console 系统内容可能不同,可以结合 console 系统中的配置文件做相应修改。
8,访问控制台: http://39.97.240.142:8080/