Install the haproxy and haproxy commands and the haproxy commands
Directory:
1. Install haproxy
2. haproxy command
1. Install haproxy
CentOS comes with haproxy, but the version may be old. You can find the latest stable version of haproxy on the IUS source.
cat <<eof>/etc/yum.repos.d/ius.repo[ius]name=iusrepobaseurl=https://mirrors.tuna.tsinghua.edu.cn/ius/stable/CentOS/$releasever/\$basearchgpgcheck=0enable=1eofyum -y install haproxy17u
The following is the process of compiling and installing the haproxy-1.7.10.
During the compilation and installation of haproxy, you can use the pcre environment. In this environment, the Compilation speed will be much faster with the help of regular expressions, but it can also be installed without this environment.
yum -y install pcre pcre-develtar xf haproxy-1.7.10.tar.gz cd haproxy-1.7.10make TARGET=linux2628 ARCH=x86_64 PREFIX=/usr/local/haproxy USE_PCRE=1make install PREFIX=/usr/local/haproxy
You must use TARGET to specify the kernel and version. The version is as follows:
- 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)- 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
Use ARCH to specify the architecture, but the ARCH option can be saved. The use of USE_PCRE = 1 indicates that the PCRE environment is used for compilation to speed up compilation.
After compilation and installation, there are only three directories: doc, share, and sbin. There is only one haproxy main program haproxy in sbin. To facilitate management of haproxy services, you can copy/etc/init.d/haproxy
.
2. haproxy command
Frequently used:
# Check the Configuration File Syntax haproxy-c-f/etc/haproxy. cfg # Start in daemon mode and use daemon mode managed by systemd to start haproxy-D-f/etc/haproxy. cfg [-p/var/run/haproxy. pid] haproxy-Ds-f/etc/haproxy. cfg [-p/var/run/haproxy. pid] # Start the debugging function and display all connection and processing information on the screen haproxy-d-f/etc/haproxy. cfg # restart. You need to use the st option to specify the pid list haproxy-f/etc/haproxy. cfg [-p/var/run/haproxy. pid]-st 'cat/var/run/haproxy. pid '# graceful restart, that is, reload. You need to use the sf option to specify the pid list haproxy-f/etc/haproxy. cfg [-p/var/run/haproxy. pid]-sf 'cat/var/run/haproxy. pid '# displays haproxy compilation and startup information haproxy-vv
Back to Linux series article outline: http://www.cnblogs.com/f-ck-need-u/p/7048359.html
Back to website architecture series article outline: http://www.cnblogs.com/f-ck-need-u/p/7576137.html
Back to database series article outline: http://www.cnblogs.com/f-ck-need-u/p/7586194.html
Reprinted please indicate the source: http://www.cnblogs.com/f-ck-need-u/p/8546010.html
Note: If you think this article is not bad, please click the recommendation in the lower right corner. Your support can stimulate the author's enthusiasm for writing. Thank you very much!