producer端发送报错
com.alibaba.rocketmq.client.exception.MQClientException: Send [3] times, still failed, cost [6244]ms, Topic: TopicTest1, BrokersSent: [fzk, fzk, fzk] See http://docs.aliyun.com/cn#/pub/ons/faq/exceptions&send_msg_failed for further details. at com.alibaba.rocketmq.client.impl.producer.DefaultMQProducerImpl.sendDefaultImpl(DefaultMQProducerImpl.java:522) at com.alibaba.rocketmq.client.impl.producer.DefaultMQProducerImpl.send(DefaultMQProducerImpl.java:1030) at com.alibaba.rocketmq.client.impl.producer.DefaultMQProducerImpl.send(DefaultMQProducerImpl.java:989) at com.alibaba.rocketmq.client.producer.DefaultMQProducer.send(DefaultMQProducer.java:90) at cn.com.fzk.Producer.sendMsg(Producer.java:48) at cn.com.fzk.Producer.main(Producer.java:66) Caused by: com.alibaba.rocketmq.remoting.exception.RemotingConnectException: connect to <172.17.0.1:10911> failed at com.alibaba.rocketmq.remoting.netty.NettyRemotingClient.invokeSync(NettyRemotingClient.java:360) at com.alibaba.rocketmq.client.impl.MQClientAPIImpl.sendMessageSync(MQClientAPIImpl.java:270) at com.alibaba.rocketmq.client.impl.MQClientAPIImpl.sendMessage(MQClientAPIImpl.java:253) at com.alibaba.rocketmq.client.impl.MQClientAPIImpl.sendMessage(MQClientAPIImpl.java:215) at com.alibaba.rocketmq.client.impl.producer.DefaultMQProducerImpl.sendKernelImpl(DefaultMQProducerImpl.java:671) at com.alibaba.rocketmq.client.impl.producer.DefaultMQProducerImpl.sendDefaultImpl(DefaultMQProducerImpl.java:440) ... 5 more
异常原因:
第一种可能:虚拟机中的网络太多。
rocketMQ在自动识别网络的时候识别错误。可以先把别的网络down掉,或者把想用的那个网让它排在前面(没验证过)
ifconfig查看网络发现还有个docker0的网络,那个ip就是172.17.0.1。因此连接不上。
先把docke0的网络停了
systemctl stop docker
sudo ifconfig docker0 down
docker服务启动后docker0网络会自动开。
systemctl start docker
只是测试的时候先把其他网络关了。如果要用docker部署,启动docker就好。
第二种:setVipChannelEnabled(false)
在启动broker的时候,启动成功后会看到broker跑在一个地址上,看上面的端口号(不是10909就是10911)和报的错的端口是否能对应上。通过producer.setVipChannelEnabled(false)来调整端口,一个是10909一个是10911,具体哪个不记得了。