Skip to content

Instantly share code, notes, and snippets.

@lefred
Last active August 29, 2015 14:13
Show Gist options
  • Save lefred/634463dff834e1933ad6 to your computer and use it in GitHub Desktop.
Save lefred/634463dff834e1933ad6 to your computer and use it in GitHub Desktop.
HaProxy configuration
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
maxconn 4096
uid 99
gid 99
daemon
defaults
log global
mode tcp
balance leastconn
option httpchk
option tcplog
option dontlognull
retries 3
option redispatch
option nolinger
maxconn 2000
timeout connect 5000
timeout client 50000
timeout server 50000
listen cluster-reads *:5306
server node1 192.168.70.1:3306 check port 9200
server node2 192.168.70.2:3306 check port 9200
server node3 192.168.70.3:3306 check port 9200
listen cluster-writes *:4306
server node1 192.168.70.1:3306 track cluster-reads/node1
server node2 192.168.70.2:3306 track cluster-reads/node2 backup
server node3 192.168.70.3:3306 track cluster-reads/node3 backup
# Stats interface
listen lb_stats *: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