Eureka 公网分布式部署

    《server》
    eureka:
        client:
            registerWithEureka: false  #false:不作为一个客户端注册到注册中心
            fetchRegistry: false      #为true时,可以启动,但报异常:Cannot execute request on any known server
            serviceUrl:
              defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
        instance:
          hostname: localhost

    《client》
    #注册中心配置(IP型)
    eureka:
      instance:
        statusPageUrlPath: /actuator/info
        healthCheckUrlPath: /actuator/health
        home-page-url-path: /
        ip-address: 120.xxx.xxx.xxx #决定Eureka服务显示host
        hostname: ${eureka.instance.ip-address} #决定服务跳转host,必须指定
        prefer-ip-address: false #不设可自己指定,true会自动获取本地ipv4地址
        instance-id: ${eureka.instance.ip-address}:${spring.application.name}:${server.port}
      client:
        serviceUrl:
          #            defaultZone: http://localhost:6600/eureka/
          defaultZone: http://120.xxx.xxx.xxx:6600/eureka/

    #注册中心配置(常规型)
    eureka:
      instance:
        statusPageUrlPath: /actuator/info
        healthCheckUrlPath: /actuator/health
        home-page-url-path: /
      client:
        serviceUrl:
          defaultZone: http://120.xxx.xxx.xxx:6600/eureka/

PS:

1、常规型配置服务必须和网关路由分发在同一机器启动。如果全部为IP型配置则无此限制,在任意机器启动,注册到同一注册中心即可。

2、此处IP必须为可用的公网IP。
 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值