I am in a situation where I have a backend with a main server A and a backup server B.
The intention is to have 100% of requests served by server A, and fallback to the server B if A is failing.
But I’d like to be able to switch the roles of the servers. Server B should them serve all the requests and the server A should become the backup i case of B failing.
I don’t want disable server A in HAproxy for it to use server B. because I still want the fallback to be possible.
I’ve found a weird option : having my 2 different configurations and a symlink to one of them to tell wich one HAProxy should use. But it forces me to reload the configuration each time I want to switch, and to maintain 2 different files.
I’ve search in the API and I’ve found my settings I can change (weight…) but nothing about the “backup” attribute of a server.
Also I didn’t find an algorithme which would do this automatically.
Anyone have an idea to solve this use case?