eureka注册时使用ip而不是hostname

eureka的client注册到server时默认是使用hostname而不是ip,这就导致client在多台机器时,服务间相互调用时也会使用hostname进行调用,从而调用失败。
这时候就需要使用ip来服务到eureka-server上,需要在eureka的client增加配置如下:
eureka.instance.prefer-ip-address=true
eureka.instance.instance-id=${spring.cloud.client.ipAddress}:${server.port}
完成后截图如下:
![这里写图片描述](https://img-blog.csdn.net/20170811134215848?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvU291bEZpZ2h0/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)

猜你喜欢

转载自blog.csdn.net/SoulFight/article/details/77096632
今日推荐