解决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}

猜你喜欢

转载自www.cnblogs.com/sprinng/p/9877960.html
今日推荐