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

上一篇:.NET(C#、VB)移动开发——Smobiler平台控件介绍:TextTabBar控件


下一篇:C#性能优化总结