Skip to content

Instantly share code, notes, and snippets.

@jayjanssen
Last active October 12, 2015 11:18
Show Gist options
  • Save jayjanssen/4018968 to your computer and use it in GitHub Desktop.
Save jayjanssen/4018968 to your computer and use it in GitHub Desktop.
haproxy config -- shared healthchecks PXC
global
log 127.0.0.1 local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 20000
user haproxy
group haproxy
daemon
#nbproc 2
spread-checks 5
# turn on stats unix socket
stats socket /var/lib/haproxy/stats
#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
mode tcp
log global
balance leastconn
option tcplog
option dontlognull
option httpchk
option tcpka
retries 3
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout check 10s
maxconn 20000
# Random Reads connection (any node)
listen all *:3306
server db1 10.2.46.120:3306 check port 9200
server db2 10.2.46.121:3306 check port 9200
server db3 10.2.46.122:3306 check port 9200
listen writes *:4306
server db1 10.2.46.120:3306 track all/db1
server db2 10.2.46.121:3306 track all/db2 backup
server db3 10.2.46.122:3306 track all/db3 backup
# Stats interface
listen lb_stats 0.0.0.0:80
mode http
balance roundrobin
stats uri /
stats realm "HAProxy Stats"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment