好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

springcloud client指定注册到eureka的ip与端口号方式

client指定注册到eureka的ip与端口号

?

1

2

3

4

5

6

#设置使用IP

eureka.instance.prefer-ip-address= true

#设置外网IP号

eureka.instance.ip-address= 49.10 . 22.106

#设置外网端口号

eureka.instance.non-secure-port= 5565

eureka注册时使用ip而不是hostname问题

eureka的client注册到server时默认是使用hostname而不是ip,这就导致client在多台机器时,服务间相互调用时也会使用hostname进行调用,从而调用失败。

这时候就需要使用ip来服务到eureka-server上

需要在eureka的client增加配置如下

?

1

2

eureka.instance.prefer-ip-address= true

eureka.instance.instance-id=${spring.cloud.client.ipAddress}:${server.port}

以上为个人经验,希望能给大家一个参考,也希望大家多多支持。

原文链接:https://blog.csdn.net/weixin_40826724/article/details/102331440

查看更多关于springcloud client指定注册到eureka的ip与端口号方式的详细内容...

  阅读:38次