Docker 部署 RocketMQ

0. 拉取镜像

shell 复制代码
docker pull apache/rocketmq:5.2.0
docker pull styletang/rocketmq-console-ng

1. 创建容器共享网络

shell 复制代码
docker network create rocketmq

2. 启动NameServer

shell 复制代码
# 启动 NameServer
docker run -d --name rmqnamesrv -p 9876:9876 --network rocketmq apache/rocketmq:5.2.0 sh mqnamesrv

# 验证 NameServer 是否启动成功
docker logs -f rmqnamesrv

我们可以看到 'The Name Server boot success...', 表示NameServer 已成功启动。

3. 启动 Broker+Proxy

shell 复制代码
# 配置 Broker 的IP地址
[root@localhost rocketmq]# cat broker.conf 
brokerClusterName=DefaultCluster
brokerName=broker-a
brokerId=0
deleteWhen=04
fileReservedTime=48
brokerRole=ASYNC_MASTER
flushDiskType=ASYNC_FLUSH


# 启动 Broker 和 Proxy
docker run -d \
--name rmqbroker \
--network rocketmq \
-p 10912:10912 -p 10911:10911 -p 10909:10909 \
-p 8080:8080 -p 8081:8081 \
-e "NAMESRV_ADDR=rmqnamesrv:9876" \
-v ./broker.conf:/home/rocketmq/rocketmq-5.2.0/conf/broker.conf \
apache/rocketmq:5.2.0 sh mqbroker --enable-proxy \
-c /home/rocketmq/rocketmq-5.2.0/conf/broker.conf

# 验证 Broker 是否启动成功
docker exec -it rmqbroker bash -c "tail -n 10 /home/rocketmq/logs/rocketmqlogs/proxy.log"

我们可以看到 'The broker boot success...', 表示 Broker 已成功启动。

4. rocketmq-console可视化界面

shell 复制代码
[root@localhost rocketmq]# docker run -d \
> --name rmqdashboard \
> --network rocketmq \
> -p 9999:8080 \
> -e "JAVA_OPTS=-Drocketmq.namesrv.addr=rmqnamesrv:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=false" \
> styletang/rocketmq-console-ng

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

shell 复制代码
[root@localhost rocketmq]# docker images
REPOSITORY                      TAG           IMAGE ID       CREATED        SIZE
apache/rocketmq                 5.2.0         07de70081c45   3 months ago   755MB
styletang/rocketmq-console-ng   latest        7df83bb6e638   6 years ago    702MB

[root@localhost rocketmq]# docker ps
CONTAINER ID   IMAGE                           COMMAND                   CREATED          STATUS          PORTS                                                                                                                                                                                           NAMES
77532423d419   styletang/rocketmq-console-ng   "sh -c 'java $JAVA_O..."   27 minutes ago   Up 27 minutes   0.0.0.0:9999->8080/tcp, :::9999->8080/tcp                                                                                                                                                       rmqdashboard
433943f15252   apache/rocketmq:5.2.0           "./docker-entrypoint..."   49 minutes ago   Up 17 minutes   0.0.0.0:8080-8081->8080-8081/tcp, :::8080-8081->8080-8081/tcp, 0.0.0.0:10909->10909/tcp, :::10909->10909/tcp, 0.0.0.0:10911-10912->10911-10912/tcp, :::10911-10912->10911-10912/tcp, 9876/tcp   rmqbroker
ae6cf4adad4a   apache/rocketmq:5.2.0           "./docker-entrypoint..."   54 minutes ago   Up 54 minutes   10909/tcp, 0.0.0.0:9876->9876/tcp, :::9876->9876/tcp, 10911-10912/tcp                                                                                                                           rmqnamesrv
相关推荐
2501_941881405 小时前
Kubernetes 容器集群资源调度与弹性扩容高可用架构在互联网业务实战经验总结
云原生·容器·kubernetes
究極の法則に通じた野犬5 小时前
k8s设计理念-k8s中哪些服务要部署成StatefulSet哪些部署成Deployment
云原生·容器·kubernetes
wuxingge5 小时前
k8s集群误删node节点,怎么添加回去
云原生·容器·kubernetes
贝锐5 小时前
Docker部署Teemii本地漫画库,并通过花生壳内网穿透实现远程访问
docker
观测云8 小时前
Kubernetes CRD 方式配置容器日志采集最佳实践
容器·kubernetes·日志分析
i***22079 小时前
springboot整合libreoffice(两种方式,使用本地和远程的libreoffice);docker中同时部署应用和libreoffice
spring boot·后端·docker
羑悻的小杀马特11 小时前
轻量跨云·掌控无界:Portainer CE + cpolar 让远程容器运维像点外卖一样简单——免复杂配置,安全直达对应集群
运维·网络·安全·docker·cpolar
EAIReport16 小时前
企业级报表自动化:基于Docker的部署实践
运维·docker·自动化
tianyuanwo18 小时前
多平台容器化RPM构建流水线全指南:Fedora、CentOS与Anolis OS
linux·运维·容器·centos·rpm
敲上瘾21 小时前
【探索实战】:Kurator分布式统一应用分发平台的全面解析与实践指南
分布式·容器·kubernetes·serverless