config注册到eureka时的ip与使用config根据服务名获取的ip不一致?

eureka注册情况

注册的是网线ip

CONFIG-SERVICE	n/a (1)	(1)	UP (1) - 192.168.0.2:8007

使用时

根据config-service服务名获取的是wifi的ip

Fetching config from server at : http://10.1.71.88:8007/
c.c.c.ConfigServicePropertySourceLocator : Connect Timeout Exception on Url - http://10.1.71.88:8007/. Will be trying the next url if available
c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://10.1.71.88:8007/
c.c.c.ConfigServicePropertySourceLocator : Connect Timeout Exception on Url - http://10.1.71.88:8007/. Will be trying the next url if available
o.s.boot.SpringApplication               : Application run failed

eureka配置

eureka:
instance:
ip-address: 192.168.0.2
hostname: 192.168.0.2

config配置

eureka:
instance:
preferIpAddress: true
instance-id: 192.168.0.2:${server.port}
appname: config-service
client:
serviceUrl:
defaultZone: http://admin:xxx@192.168.0.2:8008/eureka/

使用config

spring:
cloud:
config:
discovery:
enabled: true
service-id: config-service

想根据服务获取到网线的ip,怎么做?

回答

服务器有多个ip吧, 查看 https://www.cnblogs.com/zpKang/p/13644418.html

以上是config注册到eureka时的ip与使用config根据服务名获取的ip不一致?的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>