traefik: Support Failover Load-balancing
What version of Traefik are you using (traefik version
)?
v1.1.2
What is your environment & configuration (arguments, toml…)?
linux, simple file backend
[backends]
[backends.testing]
[backends.testing.servers.server1]
url = "http://primary:80"
weight = 1
[backends.testing.servers.server2]
url = "http://backup:80"
weight = 1
What did you do?
I want to do load balancing simple active passive. however i want to use server only as backup ( in case of failure of network issues)
What did you expect to see?
Wanted to see a simple case working where failover is supported instead of load-balancing
What did you see instead?
Couldn’t figure out how it will work by reading documentation N times.
The use case is simple i have 2 server in single backend, one primary and one backup. However i would like to sent traffic to backup only when primary is not working ( tcp connection could not be made).
I have tested some odd forms, where i add some abnormally high weight to primary and set retry to yes. In this case if primary is not responding, retry again chooses the primary instead of backup. So, retry should be skipping the primary server toactually retry. This is broken.
Can someone help me to configure such as a case ?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 40
- Comments: 21 (4 by maintainers)
The weight in
RoundRobin
is already defined, I would not try to mix that.As a user, I would prefer to have the weight within
LoadBalancer
. Maybe it would be even possible to work with positive numbers here - so you could do things like5
- (main service)5
- (second main service)3
- (fallback service - optional)1
- (maintenance site)Can we push this a little bit more? The first request was almost 4 years ago… There were already good solutions here. Can this be assigned to someone in the Traefik team?
Any update on this request please? Traefik is leap and bounds better than any reverse proxy solution available. Yet it is missing something as simple and straightforward as Active/Passive Configuration. Something which Nginx achieves using simple backup keyword against a server
upstream backend { server backend1.example.com; server backup1.example.com backup; }
The definition of backup as per documentation here https://nginx.org/en/docs/http/ngx_http_upstream_module.html
backup
Can you please consider implementing this in some form? Just because of this one functionality, we would have to use NGINX instead of Traefik 😦.
I wanted to implement blue/green deployments with resilience on a nomad cluster with consul and traefik, I hope my example helps someone.
I have a nomad cluster with blue/green instances in tomcats/docker and consul for service discovery that is used by traefik. Green instances register themselves in consul with tags traefik.http.routers.website-green.priority=123 traefik.http.routers.website-green.rule=Host(“website”) || Host(“green.website”)
similar for blue instance:
traefik.http.routers.website-blue.priority=120 traefik.http.routers.website-blue.rule=Host(“website”) || Host(“blue.website”)
This way traefik routes to green instance by default. In case the green instance dies, traefik will route to the blue instance. This mechanism can also be used for blue/green deployments in general: you deploy the blue instance, check it by accessing blue.website and if it’s ok, promote it by increasing blue priority to 126 and later deploy green/increase green priority to 124.
It would be really nice to have this! Traefik rocks, but I will probably have to choose another solution given this is not supported.
I think the Fallback mechanism within LoadBalancing itself or the WeightedRoundRobin with special weight are the best ideas here. I want to be able to load a static page if my downstream servers are having issues. I can’t seem to find a way to do this with Traefik in its current form.
I’m very much cheering for this feature as well! The use case is multiple data centers, but I’d like not to send traffic to other regions unless servers in the local region is down.