[Answered ]-Multiply Django Apache servers

2πŸ‘

βœ…

Hi @Ariel Livshits if you have under control all the underlying issues of being in this architecture like handling static files or sessions (to mention a few), you could accomplish this using HAProxy as load balancer. It’s very simple actually:

Automatic failover without failback

Sample server configuration:


 |  HAProxy  |
 -------------
  |         `
  |active    ` backup
  |           `
------       ------
| s1 |       | s2 |

The configuration below makes HAProxy to use s1 when available, otherwise fail over to s2 if available.
When a failover has occured, no failback will be processed automatically, thanks to the stick table:

peers LB
 peer LB1 10.0.0.98:1234
 peer LB2 10.0.0.99:1234

defaults
 mode http
 option http-server-close
 timeout client 20s
 timeout server 20s
 timeout connect 4s

frontend ft_app
 bind 10.0.0.100:80 name app
 default_backend bk_app

backend bk_app
 stick-table type ip size 1 nopurge peers LB
 stick on dst
 server s1 10.0.0.1:80 check
 server s2 10.0.0.2:80 check backup

Source

Leave a comment