使用的是foxiswho/docker-rocketmq,控制台报错:
ERROR 11548 --- [enderExecutor_1] c.a.c.s.b.r.i.RocketMQMessageHandler : RocketMQ Message hasn't been sent. Caused by No route info of this topic, updateUserMoney
See http://rocketmq.apache.org/docs/faq/ for further details.
tailf 跟踪一下broker日志
INFO BrokerControllerScheduledThread1 - dispatch behind commit log 0 bytes
INFO BrokerControllerScheduledThread1 - Slave fall behind master: 0 bytes
并没有发现 exception 的打印。vi 一下,发现 namesrvAddr 没值
好吧,估计是没注册到namesrv的问题。
docker rm -f rmqbroker
删除rmqbroker容器,使用下面命令重新run一下:
docker run -d -p 10911:10911 -p 10909:10909 --name rmqbroker \
-v /opt/docker-v/rocketMQ/conf/broker.conf:/etc/rocketmq/broker.conf \
-e "JAVA_OPT_EXT=-server -Xms128m -Xmx128m -Xmn128m" \
-e "NAMESRV_ADDR=rmqserver:9876" \
foxiswho/rocketmq:broker
注意 挂载目录 和 容器名, 并且需要把 rmqserver:9876 改成自己的 rmqserver所在地址和端口
docker exec -it rmqbroker /bin/bash
vi /home/rocketmq/logs/rocketmqlogs/broker.log
启动完成,进入容器查看日志,namesrvAddr有值了。
跑项目也正常了。跟踪一下broker日志
tailf /home/rocketmq/logs/rocketmqlogs/broker.log
2020-06-23 11:28:33 INFO BrokerControllerScheduledThread1 - dispatch behind commit log 0 bytes
2020-06-23 11:28:33 INFO BrokerControllerScheduledThread1 - Slave fall behind master: 0 bytes
2020-06-23 11:28:33 INFO brokerOutApi_thread_3 - register broker[0]to name server `namesrv`:9876 OK
2020-06-23 11:29:01 WARN SendMessageThread_1 - the topic updateUserMoney not exist, producer: /219.128.10.74:61797
2020-06-23 11:29:01 INFO SendMessageThread_1 - Create new topic by default topic:[TBW102] config:[TopicConfig [topicName=updateUserMoney, readQueueNums=4, writeQueueNums=4, perm=RW-, topicFilterType=SINGLE_TAG, topicSysFlag=0, order=false]] producer:[219.128.10.74:61797]
2020-06-23 11:29:01 INFO brokerOutApi_thread_4 - register broker[0]to name server `namesrv`:9876 OK
2020-06-23 11:29:03 INFO brokerOutApi_thread_1 - register broker[0]to name server `namesrv`:9876 OK
其实也可以,在控制台察看broker是否正常注册到了 serve,如下图是正常的:
另外,如果是V4_7_0 版本的话,最好参考作者的github项目 的介绍
地址:foxiswho/docker-rocketmq