-
-
Save pilgrim2go/38fac2599e7b6ed5ed54d567a722663a to your computer and use it in GitHub Desktop.
HAProxy configuration sample with resolvers options
This file contains 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
global | |
log 127.0.0.1 local2 | |
chroot /var/lib/haproxy | |
pidfile /var/run/haproxy.pid | |
maxconn 4096 | |
user haproxy | |
group haproxy | |
daemon | |
stats socket /var/lib/haproxy/stats | |
stats maxconn 1 | |
stats timeout 120s | |
resolvers awsvpc | |
nameserver vpc 172.31.0.2:53 | |
defaults | |
mode tcp | |
log global | |
retries 3 | |
timeout connect 10s | |
timeout client 1m | |
timeout server 1m | |
timeout check 10s | |
maxconn 512 | |
listen mysql | |
bind 127.0.0.1:3306 | |
mode tcp | |
option mysql-check user haproxy | |
# balance method : [roundrobin, static-rr, leastconn, source] | |
balance roundrobin | |
# usage: server hostname IP:Port check inter 2000(msec) fall 2 | |
server read01 read01.XXXXXXXXXXXX.ap-northeast-1.rds.amazonaws.com:3306 check port 3306 resolvers awsvpc inter 2000 fall 5 | |
server read02 read02.XXXXXXXXXXXX.ap-northeast-1.rds.amazonaws.com:3306 check port 3306 resolvers awsvpc inter 2000 fall 5 | |
server master master.XXXXXXXXXXXX.ap-northeast-1.rds.amazonaws.com:3306 check port 3306 resolvers awsvpc backup |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment