Created
May 29, 2016 08:33
-
-
Save uorat/00d683b74e0acd38f1bee13bb4a0bd2b to your computer and use it in GitHub Desktop.
HAProxy configuration sample with resolvers options
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
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 |
is line 15 the ip address of read01.XXXXXXXXXXXX.ap-northeast-1.rds.amazonaws.com ?
No. Thats the DNS server / resolver to be used.
I suggest to use 169.254.169.253 as DNS server address, as this is available everywhere in AWS.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
is line 15 the ip address of read01.XXXXXXXXXXXX.ap-northeast-1.rds.amazonaws.com ?