#server配置
|
server:
|
port: 9002
|
|
#spring配置
|
spring:
|
#服务名
|
application:
|
name: dyh-gateway
|
datasource:
|
druid:
|
stat-view-servlet:
|
enabled: false
|
#注册中心配置
|
eureka:
|
client:
|
service-url:
|
#注册中心单机
|
defaultZone: http://10.202.1.75:9001/eureka
|
#注册中心集群
|
#defaultZone: http://localhost:8761/eureka,http://localhost:8762/eureka
|
#是否注册到注册中心
|
register-with-eureka: true
|
#是否从注册中心拉取注册服务列表
|
fetch-registry: true
|
#首次注册时间
|
initial-instance-info-replication-interval-seconds: 2
|
#客户端定时刷新本地缓存时间
|
registry-fetch-interval-seconds: 5
|
instance:
|
prefer-ip-address: true
|
instance-id: ${spring.cloud.client.ip-address}:${server.port}
|
# 心跳时间,即服务续约间隔时间(缺省为30s)
|
lease-renewal-interval-in-seconds: 10
|
# 发呆时间,即服务续约到期时间(缺省为90s)
|
lease-expiration-duration-in-seconds: 30
|
|
#ribbon配置
|
ribbon:
|
#每台重试次数
|
MaxAutoRetries: 2
|
#最多重试多少台服务器
|
MaxAutoRetriesNextServer: 3
|
#serviceId路由时有效
|
SocketTimeout: 3000
|
#serviceId路由时有效
|
ReadTimeout: 60000
|
#Ribbon缓存时间
|
ServerListRefreshInterval: 2000
|
ConnectTimeout: 60000
|
|
#hystrix 熔断机制
|
hystrix:
|
command:
|
default:
|
fallback:
|
enabled: true # 是否开启降级服务
|
circuitBreaker:
|
enabled: true # 是否开启熔断
|
requestCache:
|
enabled: false # 设置是否缓存请求,request-scope内缓存
|
requestLog:
|
enabled: false # 设置HystrixCommand执行和事件是否打印到HystrixRequestLog中
|
execution:
|
isolation:
|
thread:
|
timeoutInMilliseconds: 60000 #降级和熔断的超时时间
|