一次使用Roocketmq,我的程序放在本机上,Roocketmq放在阿里云的一台服务器上,我在主配置文件中配置了服务器公网ip和Roocketmq的topic,名为stock。但是在使用时出现错误:
- org.apache.rocketmq.client.exception.MQClientException: No route info of this topic, stock
复制代码
服务器的Roocketmq是4.3.2,程序的Roocketmq是4.3.0版本,SpringBoot版本2.0.5 我开启Rocketmq的命令如下:
(1)开启NameServer - sh bin/mqnamesrv &
- The Name Server boot success. serializeType=JSON
复制代码
(2)开启mqbroker
- nohup sh mqbroker -n localhost:9876 autoCreateTopicEnable=true &
- #查看日志
- tail -f ~/logs/rocketmqlogs/broker.log
- #日志显示结果:
- 2020-08-11 00:08:41 INFO brokerOutApi_thread_4 - register broker to name server localhost:9876 OK
- 2020-08-11 00:09:11 INFO brokerOutApi_thread_1 - register broker to name server localhost:9876 OK
- 2020-08-11 00:09:41 INFO BrokerControllerScheduledThread1 - dispatch behind commit log 0 bytes
- 2020-08-11 00:09:41 INFO BrokerControllerScheduledThread1 - Slave fall behind master: 179890 bytes
- 2020-08-11 00:09:41 INFO brokerOutApi_thread_2 - register broker to name server localhost:9876 OK
- 2020-08-11 00:10:11 INFO brokerOutApi_thread_3 - register broker to name server localhost:9876 OK
- 2020-08-11 00:10:41 INFO BrokerControllerScheduledThread1 - dispatch behind commit log 0 bytes
- 2020-08-11 00:10:41 INFO BrokerControllerScheduledThread1 - Slave fall behind master: 179890 bytes
- 2020-08-11 00:10:41 INFO brokerOutApi_thread_4 - register broker to name server localhost:9876 OK
- 2020-08-11 00:11:11 INFO brokerOutApi_thread_1 - register broker to name server localhost:9876 OK
复制代码
(3)通过下面命令查看发现存在名为stock的topic - sh mqadmin topicList -n localhost:9876
复制代码
我在网上找到了同样的问题,
有的是说要查看防火墙,但我的防火墙是关闭的: - systemctl stop firewalld.service
- Failed to stop firewalld.service: Unit firewalld.service not loaded.
复制代码
有的说是要导入fastjson-1.2.29.jar,我也导入了。
我发现使用命令 - sh mqadmin clusterList -n localhost:9876
复制代码
显示出来的DefaultCluster的Addr字段是服务器的私网ip,不知道这是否是正确的? 想请教各位怎么解决?
|