RocketMQ 单机源码部署 自定义配置文件和端口以及acl权限配置解析

思路

1、我们首先配置完 namesrv和broker和acl认证的配置文件,然后直接使用-c指定配置文件来启动程序,就会非常明了,用户名密码要大于6,第一个用户我测试着不知道为什么始终有最高权限,大家尽量不要吧第一个用户给别人用。

1、下载源码

bash 复制代码
wget https://dist.apache.org/repos/dist/release/rocketmq/5.1.3/rocketmq-all-5.1.3-bin-release.zip

2、解压源码

bash 复制代码
unzip rocketmq-all-5.1.3-bin-release.zip

3、修改配置文件

​ 1、创建conf/namesrv.conf文件

conf 复制代码
# 监听地址和端口
listenPort=1888

​ 2、修改conf/broker.conf文件

conf 复制代码
#开启用户认证
aclEnable=true
#指定认证配置文件
aclAccessResourcePath=/home/user/rocketmq-5.1.3/conf/plain_acl.yml

# 监听地址和端口
listenPort=1889

# Name Server 地址
namesrvAddr=127.0.0.1:1888

# Broker 的集群名称
brokerClusterName=DefaultCluster

# Broker 的名称
brokerName=broker-a

# Broker 的唯一标识
brokerId=0

# 消息文件的保留时间,以小时为单位
deleteWhen=04

# 消息文件的保留时间,以小时为单位
fileReservedTime=48

# Broker 的角色
brokerRole=ASYNC_MASTER

# 磁盘刷写类型
flushDiskType=ASYNC_FLUSH

#在发送消息时,自动创建服务器不存在的Topic,默认创建的队列数
defaultTopicQueueNums=4
#是否允许Broker 自动创建Topic,建议线下开启,线上关闭
autoCreateTopicEnable=true
#是否允许Broker自动创建订阅组,建议线下开启,线上关闭
autoCreateSubscriptionGroup=true
#Broker 对外服务的监听端口
#删除文件时间点,默认是凌晨4点
deleteWhen=04
#文件保留时间,默认48小时
fileReservedTime=48
#检测物理文件磁盘空间
diskMaxUsedSpaceRatio=88
#存储路径
storePathRootDir=/home/user/rocketmq-5.1.3/store
#commitLog存储路径
storePathCommitLog=/home/user/rocketmq-5.1.3/store/commitlog
#消费队列存储路径
storePathConsumeQueue=/home/user/rocketmq-5.1.3/store/consumequeue
#消息索引存储路径
storePathIndex=/home/user/rocketmq-5.1.3/store/index
#checkpoint 文件存储路径
storeCheckpoint=/home/user/rocketmq-5.1.3/store/checkpoint
#abort 文件存储路径
abortFile=/home/user/rocketmq-5.1.3/store/abort

4、配置conf/plain_acl.yml文件

yml 复制代码
accounts:
# 账户
- accessKey: useruser
# 是否是管理员---这里警告,第一个用户似乎始终有最高权限建议非管理员向后创建
  admin: true
  # 默认主题和订阅组,不用管
  defaultGroupPerm: SUB
  defaultTopicPerm: DENY
  groupPerms: null
  # 权限密码
  secretKey: useruser
  topicPerms: null
  # 白名单
  whiteRemoteAddress: null
dataVersion:
- counter: 32
  timestamp: 1691913241329
  # 全局白名单
globalWhiteRemoteAddresses: null

5、启动

bash 复制代码
#bin/mqshutdown broker # 停止运行,不建议在生产环境这么做
#bin/mqshutdown namesrv

## 启动nameserver
## nohup xxxxx & 可以让程序进入后台运行
 nohup bin/mqnamesrv -c /home/user/rocketmq-5.1.3/conf/namesrv.conf  & 
 
 ## 启动节点  -n必须显式指定注册到那个namesrv上
sleep 3  && nohup sh bin/mqbroker -n 23.95.254.26:1888 -c /home/user/rocketmq-5.1.3/conf/broker.conf &

6、检查节点和主题

bash 复制代码
 ## 检查节点数
 sh bin/mqadmin clusterList -n 127.0.0.1:1888
 ## 检查主题
 sh bin/mqadmin topicList -n 127.0.0.1:1888

如果无法查看请更改conf/tools.yml中的用户名和密码

7、可视化工具

url 复制代码
https://rocketmq.apache.org/zh/docs/deploymentOperations/04Dashboard/#%E4%BB%8B%E7%BB%8D%E2%80%8B
相关推荐
m4Rk_10 小时前
【论文阅读】Agent 记忆机制(75):TiMem——用时间记忆树实现长期记忆的层级巩固
论文阅读·人工智能·学习·开源·github
今夕资源网11 小时前
一只鹈鹕骑着单车闯海岛:开源 3D 网页游戏《鹈鹕骑车》体验与部署教程 github开源
开源·github·ai智能测试题·ai智能测试
沙蒿同学12 小时前
我把架构约定编译成了会变红的测试:Wails v2 + Go + Vue3 桌面脚手架实战
前端·后端·github
科学熊13 小时前
RocketMQ 一主两从集群搭建与 SpringBoot 集成完整方案
rocketmq
落魄大学生之流水线上谋生计13 小时前
幻境相机 Mirage Camera
github
wangruofeng13 小时前
从一个 10 万星 AI Agent 项目里,能学到什么真正的软件工程
github·agent·ai编程
子林super14 小时前
复杂JSON Schema结构与输出校验
github
子林super14 小时前
结构化输出解析失败处理策略
github
怕浪猫14 小时前
拆解 Google《AI Agent Handbook》:企业级 Agent 的六层架构与产品矩阵
面试·github·agent
kali-Myon15 小时前
分享一个网络安全 AI 工具导航项目 SecSkills
安全·ai·github·ctf