1、Rocketmq centos7下安装及使用
下载二进制解压包,不需要编译
wget https://www-us.apache.org/dist/rocketmq/4.4.0/rocketmq-all-4.4.0-bin-release.zip
unzip rocketmq-all-4.4.0-bin-release.zip
cd rocketmq-all-4.4.0-bin-release/
vim bin/runserver.sh
vim runbroker.sh
可以创建两个脚本文件方便同时启动nameserver和broker
start.sh
#!/bin/sh
nohup sh bin/mqnamesrv &
nohup sh bin/mqbroker -n localhost:9876 &
stop.sh
#!/bin/sh
sh bin/mqshutdown broker
sh bin/mqshutdown namesrv
日志文件默认在 ~/logs/rocketmqlogs/ 目录下,查看namesrv.log和broker.log确认服务是否正常。
测试:各开一个窗口
> export NAMESRV_ADDR=localhost:9876
> 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...