Created
July 27, 2012 17:39
-
-
Save rizkyabdilah/3189291 to your computer and use it in GitHub Desktop.
Use backup server on HAProxy when connection is too much or one service is going down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
frontend frontend_service 127.0.0.1:9200 | |
mode tcp | |
balance roundrobin | |
acl max_conn_reached fe_conn gt 20 | |
acl production_almost_death nbsrv(production) lt 2 | |
default_backend production | |
use_backend production_and_backup if max_conn_reached OR production_almost_death | |
backend production | |
mode tcp | |
balance roundrobin | |
server production01 127.0.0.1:8001 check maxconn 10 | |
server production02 127.0.0.1:8002 check maxconn 10 | |
backend production_and_backup | |
mode tcp | |
balance roundrobin | |
server production01 127.0.0.1:8001 check maxconn 10 | |
server production02 127.0.0.1:8002 check maxconn 10 | |
server backup01 127.0.0.1:8003 check maxconn 10 | |
server backup02 127.0.0.1:8004 check maxconn 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I assume low maxconn, change it to suit with your needs