HAProxy logs to a syslog facility local0, via a socket connection. By default, your syslog configuration probably doesn’t accept socket connections, and doesn’t have a local0 facility, so you have no HAProxy log. If you want it, configure syslog to accept TCP connections by adding -r to syslogd parameters.
RedHat/CentOS: edit the value of SYSLOGD_OPTIONS in /etc/sysconfig/syslog SYSLOGD_OPTIONS="-m 0 -r" Debian/Ubuntu: edit the value of SYSLOGD in /etc/default/syslogd SYSLOGD="-r" Then set up syslog facility local0 and direct it to file /var/log/haproxy.log by adding this line to /etc/syslog.conf: local0.* /var/log/haproxy.log Restart syslog service: service syslog restart
haproxy + mysql配置文件
global
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4096
user haproxy
group haproxy
daemon
#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
mode http
log global
option dontlognull
option httplog
option redispatch
timeout connect 10000 # default 10 second time out if a backend is not found
timeout client 300000
timeout server 300000
maxconn 60000
retries 3
log 127.0.0.1 local3
listen admin_stats 192.168.1.113:8000
mode http
stats uri /dbs
stats realm Global\ statistics
# stats auth admin:123456
listen proxy-mysql 0.0.0.0:3306
mode tcp
balance roundrobin
option httpchk OPTIONS * HTTP/1.1\r\nHost:\ www
server hd03 10.50.12.3:3306 weight 1 check port 6033 inter 1s rise 2 fall 2
server hd05 10.50.12.5:3306 weight 1 check port 6033 inter 1s rise 2 fall 2
server hd06 10.50.12.6:3306 weight 1 check port 6033 inter 1s rise 2 fall 2
option tcpka