Instantly share code, notes, and snippets.

Embed
What would you like to do?
HAProxy configuration sample with resolvers options
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
@gandhiamarnadh

This comment has been minimized.

Show comment
Hide comment
@gandhiamarnadh

gandhiamarnadh Jul 27, 2018

is line 15 the ip address of read01.XXXXXXXXXXXX.ap-northeast-1.rds.amazonaws.com ?

gandhiamarnadh commented Jul 27, 2018

is line 15 the ip address of read01.XXXXXXXXXXXX.ap-northeast-1.rds.amazonaws.com ?

@anshprat

This comment has been minimized.

Show comment
Hide comment
@anshprat

anshprat Sep 14, 2018

is line 15 the ip address of read01.XXXXXXXXXXXX.ap-northeast-1.rds.amazonaws.com ?

No. Thats the DNS server / resolver to be used.

anshprat commented Sep 14, 2018

is line 15 the ip address of read01.XXXXXXXXXXXX.ap-northeast-1.rds.amazonaws.com ?

No. Thats the DNS server / resolver to be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment