0

I have configured my zuul proxy to work with multiple instance of my microservice . The only thing that i have done is adding ribbon.listOfServers keyword to my configuration.

It is working fine with round robin policy.

But when i shutdown one of the microservice instances ribbon still sends requests to that one and returning error to the clients.

How can i enable healthCheck feature inside the ZuulProxy ?

My zuul configuration is shown below:

shared.microservice.customer.service1.url=ip1:port1/shared/microservice/customer/

shared.microservice.customer.service2.url=ip2:port2/shared/microservice/customer/

ribbon.eureka.enabled = false

zuul.routes.customer-micro-service.path: /shared/microservice/customer/**

zuul.routes.customer-micro-service.serviceId: customers

customers.ribbon.listOfServers = ip1:port1/shared/microservice/customer/,ip2:port2/shared/microservice/customer/

My Main Spring class has the following annotations:

@EnableZuulProxy
@SpringBootApplication
@ComponentScan(basePackages = { "com.my.gateway"})
public class ZuulProxyApplication

And i am getting the below exception :

com.netflix.zuul.exception.ZuulException: Forwarding error
        at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.forward(RibbonRoutingFilter.java:143) ~[spring-cloud-netflix-core-1.0.1.RELEASE.jar!/:1.0.1.RELEASE]
        at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.run(RibbonRoutingFilter.java:107) ~[spring-cloud-netflix-core-1.0.1.RELEASE.jar!/:1.0.1.RELEASE]
        at com.netflix.zuul.ZuulFilter.runFilter(ZuulFilter.java:112) [zuul-core-1.0.28.jar!/:?]
        at com.netflix.zuul.FilterProcessor.processZuulFilter(FilterProcessor.java:197) [zuul-core-1.0.28.jar!/:?]
        at com.netflix.zuul.FilterProcessor.runFilters(FilterProcessor.java:161) [zuul-core-1.0.28.jar!/:?]
        at com.netflix.zuul.FilterProcessor.route(FilterProcessor.java:120) [zuul-core-1.0.28.jar!/:?]
        at com.netflix.zuul.ZuulRunner.route(ZuulRunner.java:84) [zuul-core-1.0.28.jar!/:?]
        at com.netflix.zuul.http.ZuulServlet.route(ZuulServlet.java:111) [zuul-core-1.0.28.jar!/:?]
        at com.netflix.zuul.http.ZuulServlet.service(ZuulServlet.java:77) [zuul-core-1.0.28.jar!/:?]


Caused by: com.netflix.hystrix.exception.HystrixRuntimeException: customersRibbonCommand failed and no fallback available.
        at com.netflix.hystrix.AbstractCommand$16.call(AbstractCommand.java:782) ~[hystrix-core-1.4.4.jar!/:1.4.4]
        at com.netflix.hystrix.AbstractCommand$16.call(AbstractCommand.java:769) ~[hystrix-core-1.4.4.jar!/:1.4.4]
        at rx.internal.operators.OperatorOnErrorResumeNextViaFunction$1.onError(OperatorOnErrorResumeNextViaFunction.java:77) ~[rxjava-1.0.7.jar!/:1.0.7]
        at rx.internal.operators.OperatorDoOnEach$1.onError(OperatorDoOnEach.java:70) ~[rxjava-1.0.7.jar!/:1.0.7]
        at rx.internal.operators.OperatorDoOnEach$1.onError(OperatorDoOnEach.java:70) ~[rxjava-1.0.7.jar!/:1.0.7]
        at rx.internal.operators.OperatorDoOnEach$1.onError(OperatorDoOnEach.java:70) ~[rxjava-1.0.7.jar!/:1.0.7]
spencergibb
  • 24,471
  • 6
  • 69
  • 75
  • I'm unsure what you mean by `healthCheck`? You can turn on ribbon retry using settings defined here http://netflix.github.io/ribbon/ribbon-core-javadoc/com/netflix/client/config/CommonClientConfigKey.html – spencergibb Apr 29 '16 at 17:53
  • I mean a background job/watchdog which will ping predefined rest endpoints in a seperate thread , If cant not get response from that endpoints will remove it(an ip of a serviceId of a microservice instance) from the zuul config automatically. ? – user1562166 May 02 '16 at 10:58
  • That is the function of the `IPing` interface. https://github.com/Netflix/ribbon/wiki/Working-with-load-balancers#components-of-load-balancer – spencergibb May 02 '16 at 15:49
  • Just a comment, if you were using Eureka for discovery, Ribbon delegates to Eureka for "ping" / health check / availability functionality. Eureka provides health check and other fine grained operational controls, insight and metadata. For example, with the Eureka REST API, you could add / remove whole fleets of instances from service in automated deployment pipelines. – MarkOfHall May 02 '16 at 16:26

0 Answers0