Linux环境docker安装RockerMQ(简单粗暴,复制即用)

发布时间:2024年01月15日

1、拉取RockerMQ镜像

docker pull apache/rocketmq

2、创建namesrv服务

mkdir -p /usr/local/rocketmq/data/namesrv/logs /usr/local/rocketmq/data/namesrv/store

3、构建namesrv容器

docker run -d \
--restart=always \
--name rmqnamesrv \
--privileged=true \
-p 9876:9876 \
-v /usr/local/rocketmq/data/namesrv/logs:/root/logs \
-v /usr/local/rocketmq/data/namesrv/store:/root/store \
-e "MAX_POSSIBLE_HEAP=100000000" \
-e "JAVA_OPT_EXT=-Xms512M -Xmx512M -Xmn128m" \
apache/rocketmq \
sh mqnamesrv

4、创建broker节点

4.1 创建broker数据数据卷

mkdir -p /usr/local/rocketmq/data/broker/logs /usr/local/rocketmq/data/broker/store /usr/local/rocketmq/conf

4.2 创建配置文件

vi /usr/local/rocketmq/conf/broker.conf

4.3 构建broker容器

docker run -d \
--restart=always \
--name rmqbroker \
--link rmqnamesrv:namesrv \
--privileged=true \
-p 10911:10911 \
-p 10912:10912 \
-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:/home/rocketmq/rocketmq-4.9.4/conf/broker.conf \
-e "NAMESRV_ADDR=namesrv:9876" \
-e "JAVA_OPT_EXT=-Xms512M -Xmx512M -Xmn128m" \
-e "MAX_POSSIBLE_HEAP=200000000" \
apache/rocketmq \
sh mqbroker -c /home/rocketmq/rocketmq-4.9.4/conf/broker.conf

5. 创建rockermq-console服务

5.1 拉取rockermq-console镜像

docker pull styletang/rocketmq-console-ng

5.2 构建rockermq-console容器

docker run -d \
--restart=always \
--name rmqadmin \
-e "JAVA_OPTS=-Drocketmq.namesrv.addr=192.168.27.129:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=false" \
-p 8081:8080 \
--ulimit nofile=1024 \
styletang/rocketmq-console-ng:latest

重点:JAVA_OPTS=-Drocketmq.namesrv.addr=192.168.27.129 中的192.168.27.129是自己的虚拟机IP地址

6. 启动mqnamesrv 和 mqbroker

6.1 启动mqnamesrv

docker start mqnamesrv

6.2 启动mqbroker

docker start rmqbroker

7. 查看控制台信息

访问虚拟机IP+端口号
比如:10.11.113.10:8081

文章来源:https://blog.csdn.net/liao3399084/article/details/135566212
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。