86 lines
2.7 KiB
Plaintext
86 lines
2.7 KiB
Plaintext
|
#---------------------------------------------------------------------
|
||
|
# Global settings
|
||
|
#---------------------------------------------------------------------
|
||
|
global
|
||
|
# to have these messages end up in /var/log/haproxy.log you will
|
||
|
# need to:
|
||
|
#
|
||
|
# 1) configure syslog to accept network log events. This is done
|
||
|
# by adding the '-r' option to the SYSLOGD_OPTIONS in
|
||
|
# /etc/sysconfig/syslog
|
||
|
#
|
||
|
# 2) configure local2 events to go to the /var/log/haproxy.log
|
||
|
# file. A line like the following can be added to
|
||
|
# /etc/sysconfig/syslog
|
||
|
#
|
||
|
#local2 /var/log/haproxy.log
|
||
|
#
|
||
|
#log 127.0.0.1 local2
|
||
|
log /dev/log local0
|
||
|
|
||
|
chroot /var/lib/haproxy
|
||
|
#pidfile /var/run/haproxy.pid
|
||
|
maxconn 80000
|
||
|
user haproxy
|
||
|
group haproxy
|
||
|
daemon
|
||
|
|
||
|
# 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
|
||
|
log global
|
||
|
retries 1
|
||
|
timeout queue 15s
|
||
|
timeout connect 7s
|
||
|
timeout client 30s
|
||
|
timeout server 30s
|
||
|
timeout check 5s
|
||
|
maxconn 3000
|
||
|
|
||
|
#---------------------------------------------------------------------
|
||
|
# main frontend which proxys to the backends
|
||
|
#---------------------------------------------------------------------
|
||
|
|
||
|
# Galera Cluster Frontend configuration
|
||
|
{% if haproxy_frontend_name is not "galera_default_frontend"%}
|
||
|
frontend {{ haproxy_frontend_name }}
|
||
|
{% else %}
|
||
|
frontend galera_default_frontend
|
||
|
{% endif %}
|
||
|
|
||
|
bind *:3306
|
||
|
mode tcp
|
||
|
option tcplog
|
||
|
tcp-request inspect-delay 5s
|
||
|
{% if haproxy_backend_name is not "galera_default_backend"%}
|
||
|
default_backend {{ haproxy_backend_name }}
|
||
|
{% else %}
|
||
|
default_backend galera_default_backend
|
||
|
{% endif %}
|
||
|
|
||
|
#---------------------------------------------------------------------
|
||
|
# active-backup redirection between the various backends
|
||
|
#---------------------------------------------------------------------
|
||
|
|
||
|
# Galera Cluster Backend configuration
|
||
|
{% if haproxy_backend_name is not "galera_default_backend"%}
|
||
|
backend {{ haproxy_backend_name }}
|
||
|
{% else %}
|
||
|
backend galera_default_backend
|
||
|
{% endif %}
|
||
|
|
||
|
mode tcp
|
||
|
option tcpka
|
||
|
option srvtcpka
|
||
|
balance roundrobin
|
||
|
option mysql-check user HaProxyLB
|
||
|
default-server inter 3s rise 2 fall 3
|
||
|
{% for node in groups[galera_cluster_nodes]%}
|
||
|
server node{{ loop.index }} {{ node }}:3306 check weight 1
|
||
|
{% endfor %}
|