一、 安装rocketmq
1.1解压安装包,检查jdk环境
java -version
unzip rocketmq-4.4.zip
1.2 修改RocketMQ启动参数
将启动所需内存改小
vi runbroker.sh
vi runserver.sh
1.3修改broker的config文件
# 默认启动时ip是localhost,如果要支持外网访问,需改为阿里云的外网ip
namesrvAddr=121.41.224.57:9876
messageIndexSafe=true
autoCreateTopicEnable=true
waitTimeMillsInSendQueue=5000
sendMessageThreadPoolNums=64
useReentrantLockWhenPutMessage=true
defaultReadQueueNums = 16
defaultWriteQueueNums = 16
# 需改为阿里云的外网ip
brokerIP1=121.41.224.57
brokerClusterName=DefaultCluster
brokerName=broker-a
brokerId=0
deleteWhen=04
fileReservedTime=48
brokerRole=ASYNC_MASTER
flushDiskType=ASYNC_FLUSH
# 监听端口,默认用10911
listenPort=10911
# 存储路径
# storePathRootDir=/usr/local/rocketmq/store
# storePathCommitLog= /usr/local/rocketmq/store/commitlog
# storePathConsumeQueue=/usr/local/rocketmq/store/consumequeue
# storePathIndex=/usr/local/rocketmq/store/index
1.4 启动RocketMQ
# 1.启动NameServer
nohup sh bin/mqnamesrv &
# 2.查看启动日志
tail -f ~/logs/rocketmqlogs/namesrv.log
# 1.启动Broker
nohup sh bin/mqbroker -n localhost:9876 &
# 2.查看启动日志
tail -f ~/logs/rocketmqlogs/broker.log
1.5 关闭RocketMQ
# 1.关闭NameServer
sh bin/mqshutdown namesrv
# 2.关闭Broker
sh bin/mqshutdown broker
二、 安装rocketmq控制台
2.1下载rocketmq-console项目
2.2修改配置文件
2.3将jar包上传到服务器上,启动命令 java -jar
阿里云需要开放端口