如何在ECS docker搭建单机版RocketMQ
【摘要】 首先确保安装了docker & docker-compose(建议参考官方文档:https://docs.docker.com/engine/ ,https://docs.docker.com/compose/install/)然后准备composer.yml文件(启动命令:docker-compose up -d)version: "3.0"services: namesrv: ...
首先确保安装了docker & docker-compose(建议参考官方文档:https://docs.docker.com/engine/ ,https://docs.docker.com/compose/install/)
然后准备composer.yml文件(启动命令:docker-compose up -d)
version: "3.0"
services:
namesrv:
image: apache/rocketmq:4.8.0
container_name: rocketmq-srv
#restart: always
volumes:
#挂载路径,冒号左边为服务器本地路径,冒号右边为容器内部路径
- /root/rocketmq/data/namesrv/logs:/root/logs
environment:
- JAVA_OPT_EXT=-server -Xms256m -Xmx256m -Xmn256m
command:
# 服务启动
sh mqnamesrv
#network_mode: host
ports:
- "9876:9876"
broker:
image: apache/rocketmq:4.8.0
container_name: rocketmq-broker
#restart: always
volumes:
- /root/rocketmq/data/broker/logs:/home/rocketmq/logs
- /root/rocketmq/data/broker/store:/home/rocketmq/store
- /root/rocketmq/etc/broker/broker.conf:/home/rocketmq/conf/broker.conf
links:
- namesrv
depends_on:
- namesrv
environment:
- NAMESRV_ADDR=namesrv:9876
- JAVA_OPT_EXT=-server -Xms512m -Xmx512m -Xmn256m
command:
# 服务启动
sh mqbroker -c /home/rocketmq/conf/broker.conf
ports:
- "10911:10911"
- "10909:10909"
- "10912:10912"
dashboard:
image: docker.io/apacherocketmq/rocketmq-dashboard
container_name: rocketmq-dashboard
links:
- namesrv
depends_on:
- namesrv
environment:
- NAMESRV_ADDR=namesrv:9876
ports:
- "8080:8080"
【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)