rocketmq安装文档

RocketMQ安装文档,单机版和集群版

单机版

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 拉取最新镜像
docker pull xuchengen/rocketmq:latest

# Linux
# --net=host 是使用宿主机端口,可以不用挂载
docker run -itd \
--name=rocketmq-standalone \
--hostname rocketmq-standalone \
-v /data/rocketmq-standalone:/usr/local/rocketmq/data \
-v /etc/localtime:/etc/localtime \
-v /var/run/docker.sock:/var/run/docker.sock \
--net=host \
xuchengen/rocketmq:latest

# 监听端口解析
-p 8080:8080 \ # 控制台监听的端口(已经配置好,无法修改)
-p 9876:9876 \ # NameServer监听的端口
-p 10909:10909 \ # Broker监听的端口,fastRemotingServer使用的端口,当vipChannelEnable开启时,才会使用该端口
-p 10911:10911 \ # Broker监听的端口,remotingServer使用的端口,主要处理生产和消费数据等操作
-p 10912:10912 \ # Broker监听的端口,主要用于Broker集群间数据通讯

会出现以下错误,暂时无法解决

1
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0)

集群版

拉取镜像

1
docker pull rocketmqinc/rocketmq:4.4.0

创建NameServer

创建相关目录

1
2
3
4
5
6
7
8
9
10
docker run -d \
--name RocketMQNamesrv \
-p 9876:9876 \
-v /data/rocketmq/namesrv/conf:/root/config \
-v /data/rocketmq/namesrv/logs:/root/logs \
-v /data/rocketmq/namesrv/store:/root/store \
-e "JAVA_OPTS=-Duser.home=/opt" \
rocketmqinc/rocketmq:4.4.0 \
sh mqnamesrv

启动broker

1
docker run -d  --name RocketMQBroker --link RocketMQNamesrv:namesrv -p 10911:10911 -p 10909:10909 -v  /data/rocketmq/broker/logs:/root/logs -v /data/rocketmq/broker/store:/root/store -v /data/rocketmq/broker/conf/broker.conf:/opt/rocketmq-4.4.0/conf/broker.conf --privileged=true -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

启动控制台

1
2
3
docker run -d --name rmqadmin -e "JAVA_OPTS=-Drocketmq.namesrv.addr=117.72.42.114:9876 \
-Dcom.rocketmq.sendMessageWithVIPChannel=false \
-Duser.timezone='Asia/Shanghai'" -v /etc/localtime:/etc/localtime -p 9999:8080 styletang/rocketmq-console-ng