docker挂载rocketmq(5.0)
·
docker-compose
version: '3.8'
services:
# NameServer 服务
namesrv:
image: docker.1ms.run/apache/rocketmq:5.1.4
container_name: rocketmq-namesrv
ports:
- "9876:9876"
environment:
- JAVA_OPT_EXT=-Xms512m -Xmx512m
command: sh mqnamesrv
volumes:
- ./data/namesrv/logs:/home/rocketmq/logs
networks:
- rocketmq-network
restart: unless-stopped
# Broker 服务
broker:
image: docker.1ms.run/apache/rocketmq:5.1.4
container_name: rocketmq-broker
ports:
- "10909:10909"
- "10911:10911"
- "10912:10912"
environment:
- NAMESRV_ADDR=namesrv:9876
- JAVA_OPT_EXT=-Xms1g -Xmx1g
command: sh mqbroker -c /home/rocketmq/rocketmq-5.1.4/conf/broker.conf
volumes:
- ./data/broker/logs:/home/rocketmq/logs
- ./data/broker/store:/home/rocketmq/store
- ./conf/broker.conf:/home/rocketmq/rocketmq-5.1.4/conf/broker.conf
- ./conf/plain_acl.yml:/home/rocketmq/rocketmq-5.1.4/conf/plain_acl.yml
depends_on:
- namesrv
networks:
- rocketmq-network
restart: unless-stopped
# RocketMQ 控制台
console:
image: docker.1ms.run/apacherocketmq/rocketmq-dashboard:latest
container_name: rocketmq-console
ports:
- "8080:8082"
environment:
- JAVA_OPTS=-Xmx256m -Xms256m
- rocketmq.config.namesrvAddr=namesrv:9876
# Dashboard 登录认证配置
- rocketmq.config.loginRequired=true
# 管理员账号密码(请修改为更安全的密码)
- rocketmq.config.dataPath=/tmp/rocketmq-console/data
# ACL 配置(Broker 启用了 ACL)
- rocketmq.config.accessKey=RocketMQ_Admin
- rocketmq.config.secretKey=AdminPass123456
volumes:
- ./conf/users.properties:/tmp/rocketmq-console/data/users.properties
depends_on:
- namesrv
networks:
- rocketmq-network
restart: unless-stopped
networks:
rocketmq-network:
driver: bridge
broker.conf
# Broker 配置文件
# Broker 集群名称
brokerClusterName = DefaultCluster
# Broker 名称
brokerName = broker-a
# Broker ID, 0 表示 Master,大于 0 表示 Slave
brokerId = 0
# NameServer 地址
namesrvAddr = namesrv:9876
# 删除文件时间点,默认凌晨 4 点
deleteWhen = 04
# 文件保留时间,默认 48 小时
fileReservedTime = 48
# Broker 的角色
# - ASYNC_MASTER 异步复制 Master
# - SYNC_MASTER 同步双写 Master
# - SLAVE
brokerRole = ASYNC_MASTER
# 刷盘方式
# - ASYNC_FLUSH 异步刷盘
# - SYNC_FLUSH 同步刷盘
flushDiskType = ASYNC_FLUSH
# Broker 对外服务的监听端口
listenPort = 10911
# 在发送消息时,自动创建服务器不存在的 topic,默认创建的队列数
defaultTopicQueueNums = 4
# 是否允许 Broker 自动创建 Topic,建议线下开启,线上关闭
autoCreateTopicEnable = true
# 是否允许 Broker 自动创建订阅组,建议线下开启,线上关闭
autoCreateSubscriptionGroup = true
# Broker 对外暴露的 IP 地址(重要:改为你的宿主机 IP 或使用 docker 网络)
brokerIP1 = 192.168.31.51
# 存储路径
# storePathRootDir = /home/rocketmq/store
# storePathCommitLog = /home/rocketmq/store/commitlog
# ACL 访问控制配置
# 启用 ACL
aclEnable = true
plain_acl.yml
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# 全局白名单配置(可选)
# 注意:RocketMQ 不支持 CIDR 格式,使用通配符格式
globalWhiteRemoteAddresses:
- 10.10.103.*
- 192.168.*.*
# ACL 账号配置
accounts:
# 管理员账号
- accessKey: RocketMQ_Admin
secretKey: AdminPass123456
whiteRemoteAddress:
admin: true
defaultTopicPerm: DENY
defaultGroupPerm: DENY
topicPerms:
groupPerms:
# 生产者账号
- accessKey: RocketMQ_Producer
secretKey: ProducerPass123456
whiteRemoteAddress:
admin: false
defaultTopicPerm: PUB
defaultGroupPerm: SUB
topicPerms:
groupPerms:
# 消费者账号
- accessKey: RocketMQ_Consumer
secretKey: ConsumerPass123456
whiteRemoteAddress:
admin: false
defaultTopicPerm: SUB
defaultGroupPerm: SUB
topicPerms:
groupPerms:
users.properties
# RocketMQ Dashboard 用户配置文件
# 格式: username=password,role
# 管理员账号
admin=admin123,1
# 普通用户账号
user=user123,2
# 角色说明:
# 1 = ADMIN (管理员,拥有所有权限)
# 2 = ORDINARY (普通用户,只读权限)
更多推荐



所有评论(0)