springcloud学习---Eureka高可用实现_03

Eureka常用配置介绍:

Eureka Server:

spring:
  application:
    name: lfq-eureka

server:
  port: 8761

eureka:
  client:
    ###代表不将自己注册到注册中心服务   集群设置为true
    register-with-eureka: false
    ##代表是否从其他注册中心服务获取服务   集群设置为true
    fetch-registry: false
    ##设置交互地址,查询以及注册都需要这个地址,多个地址用","隔开
    service-url:
      defaultZone: http://localhost:8761/eureka/
  server:
    ##关闭自我保护模式
    enable-self-preservation: false
    ##清理失效服务时间  默认6000ms            ******生产环境下不建议使用
    eviction-interval-timer-in-ms: 5000

Service:

spring:
  application:
    name: lfq-provide-8081

server:
  port: 8081

eureka:
  client:
    service-url:
      ##defaultZone: http://localhost:8761/eureka/,http://localhost:8762/eureka/
      defaultZone: http://localhost:8761/eureka/
  instance:
    ##自定义instanceID
    instance-id: ${spring.application.name}:${spring.cloud.client.ipAddress}:${spring.application.instance_id:${server.port}}
    ##设置instanceID可点击
    prefer-ip-address: true
    ##表示服务提供者发送心跳给Eureka的时间频率    默认30s
    lease-renewal-interval-in-seconds: 10
    ##表示第一次收到这个instanceID之后,在这个时间段内如果该instanceID还没有注册,则清除这个服务  默认90s
    lease-expiration-duration-in-seconds: 30

更多配置请看源码:org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean
org.springframework.cloud.netflix.eureka.server.EurekaServerConfigBean

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值