Eureka发现服务参数配置大全

详细可以参考:http://www.jianshu.com/p/e2bebfb0d075

这里只给结论。

1、eureka server

server:
    # server port
    port: 8761

eureka:
    # server自己就不要注册自己了
    client:
        registerWithEureka: false
        fetchRegistry: false
    server:
        # 关闭保护模式
        enable-self-preservation: false
        waitTimeInMsWhenSyncEmpty: 0
        # 扫描失效服务的时间
        eviction-interval-timer-in-ms: 5000

2、app server(你自己要注册的服务)

eureka:
  instance:
    appname: ${mySampleThriftServer.name}
    nonSecurePort: ${mySampleThriftServer.port}
    # 心跳时间
    lease-renewal-interval-in-seconds: 5
    # 发呆时间
    lease-expiration-duration-in-seconds: 10
  client:
    # eureka server地址
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/

3、client(要通过eureka server查找注册的服务)

我这里没有用注入,所以是euraka-client.properties

eureka.preferSameZone=true
eureka.shouldUseDns=false
eureka.serviceUrl.default=http://localhost:8761/eureka/
eureka.decoderName=JacksonJson
# just client, won't register
eureka.registration.enabled=false
# client refresh server info interval
eureka.client.refresh.interval=5

 

 

Leave a Reply

Your email address will not be published.