rocketmq server 配置docker 容器后, mq
rocketmq server 配置docker 容器后,mq client 远程发送message失败,报如下异常
send msg failed due to wait response timeout or network error,error:-1,in file </home/mzd/workspace/scva/client/libscva-cli/cpp/sdk/rocketmq-cpp/src/common/AsyncCallbackWrap.cpp> line:55
配置docker 容器后, ifconfig 信息大概如下:
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.0.11 netmask 255.255.255.0 broadcast 10.0.0.255
而远程访问 该server的地址是 192.168.1.101(路由的地址)。
解决办法:
在 conf/broker.conf 里增加一行配置brokerIP1=192.168.1.101,
broker启动时,指定conf文件
bin/mqbroker -n localhost:9876 -c conf/broker.conf
另外,rocketmq用到的默认端口
mqnamsrv: 9876
broker: 10909, 10910, 10911, 10912
以上端口要做端口映射。