首页 新闻 会员 周边

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

0
悬赏园豆:140 [已解决问题] 解决于 2022-04-10 12:53

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,怎么做?

那个谁_QQ的主页 那个谁_QQ | 初学一级 | 园豆:76
提问于:2022-04-10 02:06
< >
分享
最佳答案
0

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

收获园豆:140
czd890 | 专家六级 |园豆:14412 | 2022-04-10 11:55

感谢

那个谁_QQ | 园豆:76 (初学一级) | 2022-04-10 12:53
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册