Skip to content

Instantly share code, notes, and snippets.

@uorat
Created December 1, 2017 05:50
Show Gist options
  • Save uorat/fddaa32eaa23b4c65af579df8778dfae to your computer and use it in GitHub Desktop.
Save uorat/fddaa32eaa23b4c65af579df8778dfae to your computer and use it in GitHub Desktop.
HAProxy configuration file with Aurora endpoints
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 user root group root level admin
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 roundrobin
server reader uorat-aurora.cluster-ro-xxxxxxxxxxxx.ap-northeast-1.rds.amazonaws.com:3306 weight 1 check port 3306 resolvers awsvpc inter 2000 fall 5
server reader1 uorat-aurora-001.xxxxxxxxxxxx.ap-northeast-1.rds.amazonaws.com:3306 weight 0 check port 3306 resolvers awsvpc inter 2000 fall 5
server reader2 uorat-aurora-002.xxxxxxxxxxxx.ap-northeast-1.rds.amazonaws.com:3306 weight 0 check port 3306 resolvers awsvpc inter 2000 fall 5
server reader3 uorat-aurora-003.xxxxxxxxxxxx.ap-northeast-1.rds.amazonaws.com:3306 weight 0 check port 3306 resolvers awsvpc inter 2000 fall 5
server reader4 uorat-aurora-004.xxxxxxxxxxxx.ap-northeast-1.rds.amazonaws.com:3306 weight 0 check port 3306 resolvers awsvpc inter 2000 fall 5
server master uorat-aurora.cluster-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