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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With