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
相关推荐
go54631584657 小时前
本地部署 GitHub 上的 Python 人脸识别项目
开发语言·python·github
程序视点1 天前
惊喜升级!Claude 3.7 Sonnet 上线 GitHub Copilot!已全账号开放!
github·claude·github copilot
今晚打老虎z1 天前
MailKit: 在 .NET 中实现高效电子邮件发送与接收
git·github·.net
leafseelight1 天前
在CentOS 7上安装RocketMQ 4.9.2
linux·centos·rocketmq
架构文摘JGWZ1 天前
5个GitHub热点开源项目!!
学习·github·工具
液态不合群2 天前
DeepSeek “源神”启动!「GitHub 热点速览」
github
JNU freshman2 天前
github 推送的常见问题以及解决
git·github
cjchsh2 天前
ctfhub-web信息泄露通关攻略
windows·python·github
五行缺觉3282 天前
ROS ur10机械臂添加140夹爪全流程记录
c++·经验分享·机器人·github·ur机械臂·moveit!
無炆_2 天前
IDEA-插件开发踩坑记录-第五坑-没有飞机场导致无法访问GITHUB导致的讨厌问题
java·github·intellij-idea