1.下载rocketmq:rocketmq下载地址
2.解压 unzip rocketmq-all-4.7.1-bin-release.zip
3.启动mqnamesrv
cd rocketmq-all-4.7.1-bin-release
启动namesrv
nohup ./mqnamesrv -n127.0.0.1:9876 >/dev/null 2>&1 &
4.启动broker
nohup ./mqbroker -c ../conf/broker.conf >/dev/null 2>&1 &
5.测试
#测试消息发送命令
sh tools.sh org.apache.rocketmq.example.quickstart.Producer
#测试消息接收命令
sh tools.sh org.apache.rocketmq.example.quickstart.Consumer
6.管理工具(使用docker)
6.1拉取镜像
docker pull styletang/rocketmq-console-ng
6.2.创建并启动容器
docker run -e "JAVA_OPTS=-Drocketmq.namesrv.addr=172.17.0.3:9876 -
Dcom.rocketmq.sendMessageWithVIPChannel=false" -p 8082:8080 -t styletang/rocketmq-consoleng:1.0.0
7.管理工具,直接下载
地址:https://github.com/apache/rocketmq-externals/tree/master/rocketmq-console
mvn clean package -Dmaven.test.skip=true
java -jar target/rocketmq-console-ng-2.0.0.jar --server.port=12581 --rocketmq.config.namesrvAddr=127.0.0.1:9876
- 查看管理界面
http://localhost:8066/#/
9.集群部署
nohup sh mqbroker -n "192.168.31.46:9876;192.168.31.237:9876;192.168.31.237:9877" -c ../conf/2m-2s-sync/broker-a.properties &
nohup sh mqbroker -n "192.168.31.46:9876;192.168.31.237:9876;192.168.31.237:9877" -c ../conf/2m-2s-sync/broker-a-s.properties &
nohup sh mqbroker -n "192.168.31.46:9876;192.168.31.237:9876;192.168.31.237:9877" -c ../conf/2m-2s-sync/broker-b.properties &
nohup sh mqbroker -n "192.168.31.46:9876;192.168.31.237:9876;192.168.31.237:9877" -c ../conf/2m-2s-sync/broker-b-s.properties &
java -jar rocketmq-console-ng-1.0.1.jar --server.port=12581 --rocketmq.config.namesrvAddr="192.168.31.46:9876;192.168.31.237:9876;192.168.31.237:9877"
#关闭命令
./mqshutdown broker
./mqshutdown namesrv