1、下载
官网下载地址:https://rocketmq.apache.org/zh/docs/quickStart/01quickstart/
下载二进制包
2、上传
上传rocketmq-all-5.2.0-bin-release.zip至/home/rocketmq
解压缩:
unzip rocketmq-all-5.2.0-bin-release.zip
3、配置
broker.conf:
cd /home/rocketmq/rocketmq-all-5.2.0-bin-release
vim conf/broker.conf
如下:
brokerClusterName = DefaultCluster
brokerName = broker-a
brokerId = 0
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
# 需要配置才能自动创建主题
autoCreateTopicEnable=true
namesrvAddr=外网ip:9876
brokerIP1=外网ip
runserver.sh:
#根据自己的情况配置jvm内存大小
JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx256m -Xmn128m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
runbroker.sh:
#根据自己的情况配置jvm内存大小
JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx256m"
4、创建脚本
startNameServer.sh:
#! /bin/shnohup sh bin/mqnamesrv -n 外网ip:9876 &
startBroker.sh:
#! /bin/shnohup sh bin/mqbroker -n 外网ip:9876 -c conf/broker.conf &
stopNameServer.sh:
#! /bin/shsh bin/mqshutdown namesrv
stopBroker.sh:
#! /bin/shsh bin/mqshutdown broker
logNameServer.sh:
#! /bin/shtail -f ~/logs/rocketmqlogs/namesrv.log
logBroker.sh:
#! /bin/shtail -f ~/logs/rocketmqlogs/broker.log