Closed yelllowhat closed 8 years ago
motan获取ip的策略是hostname对应的ip --> 根据连接目标端口得到的本地ip --> 轮询网卡 请检查是不是配置了hostname。如果存在多块网卡的情况可以选择配置hostname或在service或basicservice标签下配置host属性。
感谢 @rayzhang0603 的回复 对于 hostname , 和 mutil 网卡 我第一时间就检察过, 当下 hostname 均配置的是 127.0.0.1 如下
jack@hadoop3 ~]# ping hadoop3 PING localhost.localdomain (127.0.0.1) 56(84) bytes of data. 64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=1 ttl=64 time=0.105 ms
就是在这种情况下还是出现 乱获取IP的问题,是不是 hostname 需要配置 名网地址即不能是 127.0.0.1 ?
补充: 环境是单网卡,物理机器
hostname不能是localip的。可以配置为client能够访问的具体ip,如192.168.0.10。你可以debug com.weibo.api.motan.util.NetUtils.getLocalAddress((Map<String, Integer> destHostPorts)方法,看实际获取到的ip是什么,这个ip最后会注册到注册中心。
@rayzhang0603 非常感谢,应该是这个问题。
描述: 如题,当发布服务时 注册上报的IP经常有误,如发布服务的机器是 192.168.0.10 ,上报的时候,会报成其他地址,或不同一网段和不同网络均出现过.
结果: 导致 client 引用服务时,获取不能连接报 connection timed out
排查:
错误截图: