1.连接异常

前几天在虚拟机上部署了rocketmq,一切正常,今天把rocketmq搬到了我的云主机上,一直报错
Caused by: org.apache.rocketmq.remoting.exception.RemotingConnectException:
connect to <10.19.73.64:10911> failed
反复检查了好几遍,根本没发现什么问题,也没在哪里配置过这个地址,在本地代码中,生产者类设置的namesrv的地址也是云主机的地址。

于是去看namesrv的运行日志
2018-04-21 00:13:09 INFO main -
rocketmqHome=/usr/local/rocketmq-all/target/apache-rocketmq-all 2018-04-21
00:13:09 INFO main - kvConfigPath=/root/namesrv/kvConfig.json 2018-04-21
00:13:09 INFO main - configStorePath=/root/namesrv/namesrv.properties
2018-04-21 00:13:09 INFO main - productEnvName=center 2018-04-21 00:13:09 INFO
main - clusterTest=false 2018-04-21 00:13:09 INFO main -
orderMessageEnable=false 2018-04-21 00:13:09 INFO main - listenPort=9876
2018-04-21 00:13:09 INFO main - serverWorkerThreads=8 2018-04-21 00:13:09 INFO
main - serverCallbackExecutorThreads=0 2018-04-21 00:13:09 INFO main -
serverSelectorThreads=3 2018-04-21 00:13:09 INFO main -
serverOnewaySemaphoreValue=256 2018-04-21 00:13:09 INFO main -
serverAsyncSemaphoreValue=64 2018-04-21 00:13:09 INFO main -
serverChannelMaxIdleTimeSeconds=120 2018-04-21 00:13:09 INFO main -
serverSocketSndBufSize=4096 2018-04-21 00:13:09 INFO main -
serverSocketRcvBufSize=4096 2018-04-21 00:13:09 INFO main -
serverPooledByteBufAllocatorEnable=true 2018-04-21 00:13:09 INFO main -
useEpollNativeSelector=false 2018-04-21 00:13:09 INFO main - The Name Server
boot success. serializeType=JSON 2018-04-21 00:13:09 INFO NettyEventExecuter -
NettyEventExecuter service started 2018-04-21 00:13:46 INFO
NettyServerCodecThread_1 - NETTY SERVER PIPELINE: channelRegistered
127.0.0.1:48416 2018-04-21 00:13:46 INFO NettyServerCodecThread_1 - NETTY
SERVER PIPELINE: channelActive, the channel[127.0.0.1:48416] 2018-04-21
00:13:46 INFO RemotingExecutorThread_1 - new topic registerd, BenchmarkTest
QueueData [brokerName=broker-a, readQueueNums=1024, writeQueueNums=1024,
perm=6, topicSynFlag=0] 2018-04-21 00:13:46 INFO RemotingExecutorThread_1 - new
topic registerd, OFFSET_MOVED_EVENT QueueData [brokerName=broker-a,
readQueueNums=1, writeQueueNums=1, perm=6, topicSynFlag=0] 2018-04-21 00:13:46
INFO RemotingExecutorThread_1 - new topic registerd, broker-a QueueData
[brokerName=broker-a, readQueueNums=1, writeQueueNums=1, perm=7,
topicSynFlag=0] 2018-04-21 00:13:46 INFO RemotingExecutorThread_1 - new topic
registerd, TBW102 QueueData [brokerName=broker-a, readQueueNums=8,
writeQueueNums=8, perm=7, topicSynFlag=0] 2018-04-21 00:13:46 INFO
RemotingExecutorThread_1 - new topic registerd, SELF_TEST_TOPIC QueueData
[brokerName=broker-a, readQueueNums=1, writeQueueNums=1, perm=6,
topicSynFlag=0] 2018-04-21 00:13:46 INFO RemotingExecutorThread_1 - new topic
registerd, DefaultCluster QueueData [brokerName=broker-a, readQueueNums=16,
writeQueueNums=16, perm=7, topicSynFlag=0] 2018-04-21 00:13:46 INFO
RemotingExecutorThread_1 - new broker registerd, 10.19.73.64:10911 HAServer:
10.19.73.64:10912
最后一行,broker居然也是注册到了这个地址,这个ip看着居然有点眼熟,于是打开了我的云主机,这不是我的内网IP吗!!!

原来rocketmq默认地址是内网ip,最后百度broker地址如何修改,将broker的配置文件
/usr/local/rocketmq-all/target/apache-rocketmq-all/conf/broker.conf
加上一行配置
brokerIP1 = 111.230.94.68
重启启动namesrv和broker,这里注意,我们启动broker时,原来是
nohup sh mqbroker -n localhost:9876 &
现在引用我们自定义的配置文件
nohup sh mqbroker -n localhost:9876 -c ../conf/broker.conf &然后把程序跑起来测试,OK了

技术
©2019-2020 Toolsou All rights reserved,
JVM内存模型(面试自用)2021年2月中国编程语言排行榜【操作系统----Linux】常用杀毒软件详解ubuntu14.04如何设置静态IP排序(一)冒泡排序法JS 的骚操作漫画 | CPU战争40年,真正的王者终于现身!python中解决字典写入列表的问题C语言控制台小游戏,打砖块SpringBoot实践(五):mybatis-plus中的BaseMapper,Iservice和ServiceImpl