springCloud 之 Eureka注册中心高可用配置

Eureka1 配置

#高可用实例1
spring:
  application:
    name: eureka

server:
  port: 8010

#eureka.instance.lease-expiration-duration-in-seconds
#eureka server设置剔除出注册中心的超时时间(单位:秒)

#eureka.instance.lease-renewal-interval-in-seconds
#eureka client客户端发送心跳给服务端的频率. 该值至少要比lease-expiration-duration-in-seconds小才有意义(单位:秒)

#eureka.client.registry-fetch-interval-seconds
#eureka client客户端更新注册发现的时间间隔(单位:秒)

eureka:
  instance:
    hostname: dev1
    lease-expiration-duration-in-seconds: 30
    lease-renewal-interval-in-seconds: 10
    appname: ${spring.application.name}
  client:
    registerWithEureka: false
    fetchRegistry: false
    serviceUrl:
      defaultZone: http://localhost:8011/eureka/,http://localhost:8012/eureka/
    registry-fetch-interval-seconds: 5
  server:
    enable-self-preservation: false
    eviction-interval-timer-in-ms: 10000 #清理无效节点的时间间隔,默认60000毫秒,即60秒

management:
  server:
    port: ${server.port}
  endpoints:
    web:
      exposure:
        include: '*'
    jmx:
      exposure:
        include: '*'
  endpoint:
    health:
      show-details: always

Eureka2 配置

#高可用实例1
spring:
  application:
    name: eureka

server:
  port: 8011

#eureka.instance.lease-expiration-duration-in-seconds
#eureka server设置剔除出注册中心的超时时间(单位:秒)

#eureka.instance.lease-renewal-interval-in-seconds
#eureka client客户端发送心跳给服务端的频率. 该值至少要比lease-expiration-duration-in-seconds小才有意义(单位:秒)

#eureka.client.registry-fetch-interval-seconds
#eureka client客户端更新注册发现的时间间隔(单位:秒)

eureka:
  instance:
    hostname: dev2
    lease-expiration-duration-in-seconds: 30
    lease-renewal-interval-in-seconds: 10
    appname: ${spring.application.name}
  client:
    registerWithEureka: false
    fetchRegistry: false
    serviceUrl:
      defaultZone: http://localhost:8010/eureka/,http://localhost:8012/eureka/
    registry-fetch-interval-seconds: 5
  server:
    enable-self-preservation: false
    eviction-interval-timer-in-ms: 10000 #续期时间,清理无效服务的时间间隔,默认是60*1000

management:
  server:
    port: ${server.port}
  endpoints:
    web:
      exposure:
        include: '*'
    jmx:
      exposure:
        include: '*'
  endpoint:
    health:
      show-details: always

Eureka3 配置

#高可用实例1
spring:
  application:
    name: eureka

server:
  port: 8012

#eureka.instance.lease-expiration-duration-in-seconds
#eureka server设置剔除出注册中心的超时时间(单位:秒)

#eureka.instance.lease-renewal-interval-in-seconds
#eureka client客户端发送心跳给服务端的频率. 该值至少要比lease-expiration-duration-in-seconds小才有意义(单位:秒)

#eureka.client.registry-fetch-interval-seconds
#eureka client客户端更新注册发现的时间间隔(单位:秒)

eureka:
  instance:
    hostname: dev3 #服务注册中心实例主机名
    lease-expiration-duration-in-seconds: 30
    lease-renewal-interval-in-seconds: 10
    appname: ${spring.application.name}
  client:
    registerWithEureka: false #是否向注册中心注册自己
    fetchRegistry: false #是否获取注册表
    serviceUrl:
      defaultZone: http://localhost:8010/eureka/,http://localhost:8011/eureka/
    registry-fetch-interval-seconds: 5
  server:
    enable-self-preservation: false
    eviction-interval-timer-in-ms: 10000 #续期时间,清理无效服务的时间间隔,默认是60*1000

management:
  server:
    port: ${server.port}
  endpoints:
    web:
      exposure:
        include: '*'
    jmx:
      exposure:
        include: '*'
  endpoint:
    health:
      show-details: always

client 配置

server:
  port: 8021

eureka:
  client:
    serviceUrl:
      defaultZone: http://localhost:8010/eureka/,http://localhost:8011/eureka/,http://localhost:8012/eureka/

spring:
  zipkin:
    base-url: http://localhost:9411
  sleuth:
    sampler:
      probability: 1.0

 

posted @ 2020-07-23 16:07  mhx_pyw  阅读(186)  评论(0编辑  收藏  举报