centos7 安装 rocketMQ 二进制发行版

2021-01-29  本文已影响0人  爱烫头的程序员
  1. 下载二进制版本,解压迁移目录
wget https://mirrors.bfsu.edu.cn/apache/rocketmq/4.8.0/rocketmq-all-4.8.0-bin-release.zip
unzip rocketmq-all-4.8.0-bin-release.zip
mv rocketmq-all-4.8.0-bin-release /usr/local/rocketmq
  1. 配置环境变量
echo -e '\nexport ROCKETMQ_HOME=/usr/local/rocketmq\n' >> /etc/profile
echo -e '\nexport PATH=$PATH:${ROCKETMQ_HOME}/bin\n' >> /etc/profile
echo -e '\nexport NAMESRV_ADDR=localhost:9876\n' >> /etc/profile
source /etc/profile
  1. 修改启动脚本, 根据自己服务器的内存情况,调整占用的内存大小,防止内存不足(可选
vim /usr/local/rocketmq/bin/runserver.sh
vim /usr/local/rocketmq/bin/runbroker.sh
  1. 尝试启动
cd /usr/local/rocketmq/
nohup sh bin/mqnamesrv &
tail -f ~/logs/rocketmqlogs/namesrv.log

The Name Server boot success...

nohup sh bin/mqbroker -n localhost:9876 &
nohup sh bin/mqbroker -n localhost:9876 -c ./conf/broker.conf &
tail -f ~/logs/rocketmqlogs/broker.log 

The broker[%s, 172.30.30.233:10911] boot success...

  1. 测试发送和消费消息
sh bin/tools.sh org.apache.rocketmq.example.quickstart.Producer

SendResult [sendStatus=SEND_OK, msgId= ...

sh bin/tools.sh org.apache.rocketmq.example.quickstart.Consumer

ConsumeMessageThread_%d Receive New Messages: [MessageExt...

  1. 关闭服务
sh bin/mqshutdown broker

The mqbroker(36695) is running...
Send shutdown request to mqbroker(36695) OK

sh bin/mqshutdown namesrv

The mqnamesrv(36664) is running...
Send shutdown request to mqnamesrv(36664) OK

上一篇下一篇

猜你喜欢

热点阅读