recketMQ 的安装

#启动name Server
nohup sh bin/mqnamesrv &
#验证是否启动ok
tail -f ~/logs/rocketmqlogs/namesrv.log
#成功标识
# 2021-02-24 16:24:44 INFO main - The Name Server boot success. serializeType=JSON

#启动Broker
nohup sh bin/mqbroker -n localhost:9876  autoCreateTopicEnable=true  &

#验证是否成功
tail -f ~/logs/rocketmqlogs/broker.log

#如果成功会有以下信息
2021-02-24 16:35:45 INFO main - The broker[jun, 192.168.0.148:10911] boot success. serializeType=JSON and name server is localhost:9876

验证生产消息正常

export NAMESRV_ADDR=localhost:9876
sh bin/tools.sh org.apache.rocketmq.example.quickstart.Producer

# 出现一下信息表示正常
SendResult [sendStatus=SEND_OK, msgId=C0A82

验证消费消息正常

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

# 看到一下信息表示正常
ConsumeMessageThread_4 Receive New Messages: [MessageExt

服务的停止

# 命令
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

RocketMq 管理页面搭建

  1. 下载管理页面源码
git clone https://github.com/apache/rocketmq-externals
cd rocketmq-externals/rocketmq-console
mvn package -DskipTests
cd target 
nohup java -jar rocketmq-console-ng-2.0.0.jar --server.port=12581 --rocketmq.config.namesrvAddr=192.168.0.148:9876 > nohup.out  2>&1 &

你可能感兴趣的:(消息队列,recetMq,linux,运维)