天道酬勤
- 启动ES:docker run -itd --name es -p 9200:9200 -p 9300:9300 -e “discovery.type=single-node” elasticsearch /bin/bash
- 启动消息队列:docker run -itd -p 9876:9876 rocketmqinc/rocketmq:4.2.0
Rocketmq
- 启动 NameServer:
nohup sh bin/mqnamesrv &; tail -f ~/logs/rocketmqlogs/namesrv.log
- 启动 Broker:
nohup sh bin/mqbroker -n localhost:9876 &; tail -f ~/logs/rocketmqlogs/broker.log
- 测试发送和接受消息:
- 发送消息:
export NAMESRV_ADDR=localhost:9876; sh bin/tools.sh org.apache.rocketmq.example.quickstart.Producer
- 接受消息:
sh bin/tools.sh org.apache.rocketmq.example.quickstart.Consumer
- 发送消息:
- 关闭服务:
sh bin/mqshutdown broker // 停止 broker
sh bin/mqshutdown namesrv // 停止 nameserver
- 查看集群情况:
./mqadmin clusterList -n 127.0.0.1:9876
- 查看 broker 状态:
./mqadmin brokerStatus -n 127.0.0.1:9876 -b 172.20.1.138:10911
- 查看 topic 列表:
./mqadmin topicList -n 127.0.0.1:9876
- 查看 topic 状态:
./mqadmin topicStatus -n 127.0.0.1:9876 -t MyTopic
- 查看 topic 路由:
./mqadmin topicRoute -n 127.0.0.1:9876 -t MyTopic