我有一個Spring Boot Zuul作爲外部網關和Eureka作爲服務發現的場景,所有這些都在Kubernetes中運行。Zuul重試配置不適用於Eureka
事情是,我想保證我的服務的可用性,所以當我的服務實例出現故障時,我希望Zuul通過Eureka重新嘗試調用其他實例之一。
我試着按照這樣做Ryan Baxter's post。 另外,我試圖按照here的提示進行操作。
問題是,無論我做什麼,看起來像Zuul不會重試打電話。當我刪除我的一個實例時,它會一直向我返回此實例的超時,直到Eureka地址得到同步。
我application.yaml看起來是這樣的:
spring:
cloud:
loadbalancer:
retry:
enabled: true
zuul:
stripPrefix: true
ignoredServices: '*'
routes:
my-service:
path: /my-service/**
serviceId: my-service-api
retryable: true
my-service:
ribbon:
maxAutoRetries: 3
MaxAutoRetriesNextServer: 3
OkToRetryOnAllOperations: true
ReadTimeout: 5000
ConnectTimeout: 3000
我的服務是使用卡姆登SR7(我也試過SR6):
"org.springframework.cloud:spring-cloud-dependencies:Camden.SR7"
而且還彈簧重試:
org.springframework.retry:spring-retry:1.1.5.RELEASE
我的應用程序類看起來像這樣:
@SpringBootApplication
@EnableEurekaClient
@EnableZuulProxy
@EnableRetry
public class MyZuulApplication
編輯:
製作打通郵差,它帶來
{
"timestamp": 1497959364819,
"status": 500,
"error": "Internal Server Error",
"exception": "com.netflix.zuul.exception.ZuulException",
"message": "TIMEOUT"
}.
以一看Zuul日誌,它印{"level":"WARN","logger_name":"org.springframework.cloud.netflix.zuul.filters.post.SendErrorFilter","appName":...,"message":"Error during filtering","stack_trace":"com.netflix.zuul.exception.ZuulException: Forwarding error [... Stack Trace ...] Caused by: com.netflix.hystrix.exception.HystrixRuntimeException: my-service-api timed-out and no fallback available [... Stack Trace ...] Caused by: java.util.concurrent.TimeoutException: null
另一個有趣的日誌,我發現:
{"level":"INFO" [...] current list of Servers=[ip_address1:port, ip_address2:port, ip_address3:port],Load balancer stats=Zone stats: {defaultzone=[Zone:[ ... ]; Instance count:3; Active connections count: 0; Circuit breaker tripped count: 0; Active connections per server: 0.0;]
},Server stats: [[Server:ip_address1:port; [ ... ] Total Requests:0; Successive connection failure:0; Total blackout seconds:0; [ ... ]
, [Server:ip_address2:port; [ ... ] Total Requests:0; Successive connection failure:0; Total blackout seconds:0; [ ... ]
, [Server:ip_address3:port; [ ... ] Total Requests:0; Successive connection failure:0; Total blackout seconds:0; [ ... ]
你得到了什麼確切的例外? –
我編輯原始文章的一些更多的信息 –