当前位置:   article > 正文

Spring-cloud Eureka 集群

Spring-cloud Eureka 集群

eureka service 配置文件

1、host 文件

  1. 127.0.0.1 localhost-01
  2. 127.0.0.1 localhost-02
  3. 127.0.0.1 localhost-03
  • 1
  • 2
  • 3

2、第一台service–8001端口

  1. server:
  2. port: 8001
  3. eureka:
  4. instance:
  5. hostname: localhost-01
  6. client:
  7. register-with-eureka: true
  8. fetch-registry: true
  9. service-url:
  10. #default-zone: http://${eureka.instance.hostname}:8001/eureka/,http://${eureka.instance.hostname}:8002/eureka/
  11. default-zone: http://localhost-02:8002/eureka/,http://localhost-03:8003/eureka/
  12. server:
  13. enable-self-preservation: false # 设为false,关闭自我保护
  14. eviction-interval-timer-in-ms: 4000 # 清理间隔(单位毫秒,默认是60*1000
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

3、第二台service–8002端口

  1. server:
  2. port: 8001
  3. eureka:
  4. instance:
  5. hostname: localhost-02
  6. client:
  7. register-with-eureka: true
  8. fetch-registry: true
  9. service-url:
  10. #default-zone: http://${eureka.instance.hostname}:8001/eureka/,http://${eureka.instance.hostname}:8002/eureka/
  11. default-zone: http://localhost-01:8000/eureka/,http://localhost-03:8003/eureka/
  12. server:
  13. enable-self-preservation: false # 设为false,关闭自我保护
  14. eviction-interval-timer-in-ms: 4000 # 清理间隔(单位毫秒,默认是60*1000
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

4、第三台service–8003端口

  1. server:
  2. port: 8000
  3. eureka:
  4. instance:
  5. hostname: localhost
  6. client:
  7. register-with-eureka: true
  8. fetch-registry: true
  9. service-url:
  10. default-zone: http://${eureka.instance.hostname}:8000/eureka/,http://${eureka.instance.hostname}:8001/eureka/
  11. server:
  12. enable-self-preservation: false # 设为false,关闭自我保护
  13. eviction-interval-timer-in-ms: 4000 # 清理间隔(单位毫秒,默认是60*1000
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

以上配置实现两两关联

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/944099
推荐阅读
相关标签
  

闽ICP备14008679号