Skip to content

Instantly share code, notes, and snippets.

@cdolek
Created October 31, 2014 00:50
Show Gist options
  • Save cdolek/a015abc3c09808fb14b7 to your computer and use it in GitHub Desktop.
Save cdolek/a015abc3c09808fb14b7 to your computer and use it in GitHub Desktop.
haproxy v0.5 configuration for mysql cluster load balancing
global
log 127.0.0.1 local0 notice
chroot /var/lib/haproxy
user haproxy
group haproxy
# daemon
defaults
log global
# mode http
option tcplog
option dontlognull
option redispatch
retries 2
maxconn 2000
timeout connect 3000
timeout client 5000
timeout server 5000
listen mysql-cluster 127.0.0.1:3306
mode tcp
option tcpka
balance roundrobin
option mysql-check user haproxy_check
server db1 192.168.1.1:3306 check
server db2 192.168.1.2:3306 check
server db3 192.168.1.3:3306 check backup # like down
listen web-interface 0.0.0.0:8080
mode http
stats enable
stats uri /
stats realm Strictly\ Private
stats auth someuser:somepassword
stats auth Another_User12352488767342:passwd34598797234
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment