正文
A服务重启,zuul不添加重试机制,会报A服务错误异常
修改网关配置文件
hystrix:
command:
default:
execution:
isolation:
thread:
timeout-in-milliseconds: 20000
zuul:
host:
connect-timeout-millis: 20000
socket-timeout-millis: 20000
routes:
#user微服务
userService:
#以/user为头部的请求都转发到user里
path: /user/**
serviceId: user
#url: http://localhost:8091
pickupService:
#以/pickup为头部的请求都转发到pickup里
path: /pickup/**
serviceId: pickup
orderService:
#以/order为头部的请求都转发到order里
path: /order/**
serviceId: order
#是否开启重试功能
retryable: true
ribbon:
#解决zuul转发请求导致的超时问题
ReadTimeout: 60000
SocketTimeout: 60000
#对当前服务的重试次数
MaxAutoRetries: 2
#切换相同Server的次数
MaxAutoRetriesNextServer: 0