RocketMq消息队列
//历史版本
https://archive.apache.org/dist/rocketmq/
本地安装目录
#安装目录
~/work/rocketmq-all-4.8.0-bin-release/bin
#启动namesrv bash
nohup sh mqnamesrv &
#查看日志
tail -f ~/logs/rocketmqlogs/namesrv.log
#启动mqbroker
nohup sh mqbroker -n localhost:9876 autoCreateTopicEnable=true &
#查看日志
tail -f ~/logs/rocketmqlogs/broker.log
#控制台
控制台
https://github.com/apache/rocketmq-externals
#下载控制台git代码后本地启动
http://localhost:8080/#/
#修改application.properties
rocketmq.config.namesrvAddr=localhost:9876
## 启动时会报错,本地连接不上,所以要加上启动国参数
## 在idea上配置program arguments
java -jar rocketmq-console-ng-1.0.1.jar --rocketmq.config.namesrvAddr=localhost:9876
创建Topic
usage: mqadmin updateTopic [-b <arg>] [-c <arg>] [-h] [-n <arg>] [-o <arg>] [-p <arg>] [-r <arg>] [-s <arg>]
-t <arg> [-u <arg>] [-w <arg>]
-b,--brokerAddr <arg> create topic to which broker
-c,--clusterName <arg> create topic to which cluster
-h,--help Print help
-n,--namesrvAddr <arg> Name server address list, eg: 192.168.0.1:9876;192.168.0.2:9876
-o,--order <arg> set topic's order(true|false)
-p,--perm <arg> set topic's permission(2|4|6), intro[2:W 4:R; 6:RW]
-r,--readQueueNums <arg> set read queue nums
-s,--hasUnitSub <arg> has unit sub (true|false)
-t,--topic <arg> topic name
-u,--unit <arg> is unit topic (true|false)
-w,--writeQueueNums <arg> set write queue nums
#创建topic
sh mqadmin updateTopic -n 127.0.0.1:9876 -c DefaultCluster -t topic_2021_byhand
#查看路由
sh mqadmin topicRoute -n 127.0.0.1:9876 -t topic_2021_byhand
发送消息测试
sh tools.sh org.apache.rocketmq.example.quickstart.Producer
错误
2021-01-02 00:00:14,995 WARN RocketmqClient - get Topic [TOPIC_2021] RouteInfoFromNameServer is not exist value
2021-01-02 00:00:14,996 WARN RocketmqClient - updateTopicRouteInfoFromNameServer Exception
org.apache.rocketmq.client.exception.MQClientException: CODE: 17 DESC: No topic route info in name server for the topic: TOPIC_2021
最佳实践
https://github.com/apache/rocketmq/blob/master/docs/cn/best_practice.md
https://rocketmq-1.gitbook.io/rocketmq-connector/rocketmq-connect/ying-yong-chang-jing
最后用了两台电脑,在本机上一直生产者发送一直报异常。