Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to forward all requests to specific version (of same service) during deployment using netflix?

I have 4 instance of the same service running on different hosts. I am deploying new version for that service node by node. While deployment, incoming requests get forwarded according to the load balancer to any version (host). Is there any way in netflix where I can forward all incoming requests to a specific version?

Is there any generic way where we can define version (for same serviceId). And if incoming requests has version defined in header, we can use that to forward the requests to specific version.

Could be something like:

In Zuul Proxy,

zuul:
  routes:
    sample:
      path: /sample/{version}/**
      serviceId: sample-service

In sample-service,

eureka:
  instance:
    appname: sample-service
    metadataMap:
      version: v1

or any other mechanism to achieve versioning of same service?

like image 368
Gaurav Ajmera Avatar asked Sep 22 '15 11:09

Gaurav Ajmera


1 Answers

I think you are heading the right way. You can write your own @RibbonClient which is basically a @Configuration class for loadbalancing per service.

@RibbonClient(name = "yourServiceName", configuration = RibbonConfigForThatService.class) .

In that you can place your own IRule - and if needed any other component - for that service. With this you can filter the instances available for loadbalancing based on their metadata.

RoundRobinRule does a simple round robin loadbalancing, good example for further needs.

like image 179
Ákos Ratku Avatar answered Jan 02 '23 20:01

Ákos Ratku