1.镜像地址下载mq
wget https://mirrors.tuna.tsinghua.edu.cn/apache/rocketmq/4.7.1/rocketmq-all-4.7.1-bin-release.zip
2.解压zip包
unzip xxxx.zip
3.需要开放端口号。nameserver是固定的9876。但是broker是可以调整的,特别是一台虚拟机如果部署多个broker的话。就需要自定义Port。我这里目前是采用两台虚拟机,然后每台起两个broker都是对另外虚拟机的slave部署。
查看开放的端口号:
firewall-cmd --list-all
重载防火墙
firewall-cmd --reload
开放端口命令:
firewall-cmd --zone=public --add-port=port/tcp --permanent
4.修改conf/2m-2s-async下的配置文件
5.顺序启动组件 namesrv(所有机子的nameserver) -----> broker(主)------>broker(从),采用nohup启动,是不会有报错信息提供的
nohup sh bin/mqbroker -n localhost:9876 -c conf/broker.conf autoCreateTopicEnable=true & tail -f ~/logs/rocketmqlogs/broker.log
broker配置:
brokerClusterName = DefaultCluster
brokerName = broker-a
brokerId = 0
brokerIP1=192.168.1.150 #这个IP是本地内网IP地址
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
autoCreateTopicEnable=true #自动创建topic配置
autoCreateSubscriptionGroup=true #自动创建注册组配置
rejectTransactionMessage=false #默认
false transactionTimeOut=6000 #超时时间