$ cat /etc/redhat-release CentOS Linux release 7.6.1810 (Core)
$ uname -r 3.10.0-1062.9.1.el7.x86_64
HAProxy 1.8支持的 OS
make时需要使用TARGET指定内核及版本,版本如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
To build haproxy, you have to choose your target OS amongst the following ones and assign it to the TARGET variable :
- linux22 for Linux 2.2 - linux24 for Linux 2.4 and above (default) - linux24e for Linux 2.4 with support for a working epoll (> 0.21) - linux26 for Linux 2.6 and above - linux2628 for Linux 2.6.28, 3.x, and above (enables splice and tproxy) #<== CentOS7 匹配该版本 - solaris for Solaris 8 or 10 (others untested) - freebsd for FreeBSD 5 to 10 (others untested) - netbsd for NetBSD - osx for Mac OS/X - openbsd for OpenBSD 5.7 and above - aix51 for AIX 5.1 - aix52 for AIX 5.2 - cygwin for Cygwin - haiku for Haiku - generic for any other OS or version. - custom to manually adjust every setting
$ vim /usr/local/haproxy/etc/haproxy.cfg global daemon log 127.0.0.1 local3 warning chroot /usr/local/haproxy pidfile /usr/local/haproxy/run/haproxy.pid maxconn 50000 user haproxy group haproxy
#####==================== tandy mysql ===================== listen tandy_mysql_read_3306 bind *:3306 mode tcp timeout client 10800s timeout server 10800s balance leastconn server mysql_slave1_000001_3306 10.19.0.1:3306 check inter 3s rise 5 fall 6 weight 10 server mysql_slave2_000002_3306 10.19.0.2:3306 check inter 3s rise 5 fall 6 weight 10 server mysql_master_000003_3306 10.19.0.3:3306 check inter 3s rise 5 fall 6 weight 10 backup
$ vim /etc/rsyslog.conf $ModLoad imudp $UDPServerRun 514 local3.* /var/log/haproxy.log
配置 /etc/sysconfig/rsyslog
1 2 3 4 5 6
$ vim /etc/sysconfig/rsyslog # Options for rsyslogd # Syslogd options are deprecated since rsyslog v3. # If you want to use them, switch to compatibility mode 2 by "-c 2" # See rsyslogd(8) for more details SYSLOGD_OPTIONS="-r -m 0 -c 2"