Hi
I want to associate a set of backends with a user/tenant and load balance those backends by user/tenant.
I want the same user id to load balance to the same set of servers.
I am reading Haproxy sourcecode trying to work out where to put this functionality.
Say I have X tenants or users and Y servers. The users only exist on X/Y servers.
I suspect I can (a) download a user to server mapping list on startup. (B) introduce a header that the backend server replies with the set of servers to be used by that user once logged in.
I need to override the load balancing to only use servers that are mapped by a user id. A user stays on a particular server
I could generate a very large configuration file but I was hoping there was a way I can do this dynamically. I could use Consul and consul template to template the user to server mappings for example.
defaults
mode http
timeout client 10s
timeout connect 5s
timeout server 10s
timeout http-request 10s
frontend frontend
bind 127.0.0.1:80
default_backend serverfarm
backend serverfarm
sharding cookie SERVER shardserver:5006/users.json
cookie SERVER insert indirect nocache
server server1 server1:8000
server server2 server2:8000
server server3 server3:8000
server server4 server4:8000
server server5 server5:8000
server server6 server6:8000
server server7 server7:8000
server server8 server8:8000
server server9 server9:8000
1 post - 1 participant