- 参数配置
- 全局方式:
ribbon.<key>=<value>
,例如ribbon.ConnectTimeout=250 - 指定客户端:
<client>.ribbon.<key>=<value>
- 全局方式:
- 重试机制
- 开启重试机制spring.cloud.loadbalancer.retry.enable=true,默认关闭
- 断路器超时时间(需大于ribbon的超时时间,否则不会触发重试)
hystrix.command.default.execution.isolation.thread.timeoutInmilliseconds=10000 - 连接超时时间hello-service.ribbon.ConnectTimeout=250
- 请求超时时间hello-service.ribbon.ReadTimeout=1000
- 对所有操作请求都重试hello-service.ribbon.OkToRetryOnAllOperations=true
- 对当前实例的重试次数hello-service.ribbon.MaxAutoRetries=1
- 切换实例的重试次数hello-service.ribbon.MaxAutoRetriesNextServers=2