Load balancing tool haproxy installation, configuration, use the basic tutorial

  
 First, what is haproxyHAProxy provides high availability, load balancing, and agents based on TCP and HTTP applications, supporting virtual hosts, which is a free, fast and reliable solution. HAProxy is especially useful for those highly loaded web sites that typically require session persistence or seven layers of processing. HAProxy runs on current hardware and can support tens of thousands of concurrent connections. And its operating mode makes it easy to integrate into your current architecture, while protecting your web server from being exposed to the network.
It supports network switching from Layer 4 to Layer 7, ie covering all TCP protocols. That is to say, Haproxy even supports the balanced load of Mysql. . If it is said that the WEB balanced load can be implemented in the proxy reverse proxy mode, there are many such products. Including Nginx, ApacheProxy, lighttpd, Cheroke, etc. But to be clear, Haproxy is not an Http server. All of the products mentioned above with a reverse proxy equalization load are all WEB servers. Simply put, they can provide static (html, jpg, gif..) or dynamic (php, cgi..) file transfers and processing. Haproxy is only, and is specifically an application agent for balancing loads. It does not provide http services by itself.
Second, install haproxy download list address http://haproxy.1wt.eu
#wget http://haproxy.1wt.eu/download/1.4/src/haproxy-1.4.8.tar.gz# Tar zxvf haproxy-1.4.8.tar.gz#cd haproxy-1.4.8#uname -a //View linux kernel version #make TARGET=linux26 PREFIX=/usr/local/haproxy#make install PREFIX=/usr/local /haproxy

Third, the configuration haproxy
#vi /usr/local/haproxy/haproxy.cfg

modify the configuration file maxconn 5120 chroot /usr /local /haproxy to
global Uid 99 gid 99 daemon quiet nbproc 2 pidfile /usr/local/haproxy/haproxy.pid defaults log global mode http option httplog option dontlognull log 127.0.0.1 local3 retries 3 option redispatch maxconn 2000 contimeout 5000 clitimeout 50000 srvtimeout 50000 listen webinfo :1080 mode Http balance roundrobin option httpclose Option forwardfor server phpinfo1 192.168.18.2:10000 check weight 1 minconn 1 maxconn 3 check inter 40000 server phpinfo2 127.0.0.1:80 check weight 1 minconn 1 maxconn 3 check inter 40000 listen webmb :1081 mode http balance roundrobin option httpclose option forwardfor server webmb1 192.168.1.91:10000 weight 1 minconn 1 maxconn 3 check inter 40000 server webmb2 127.0.0.1:10000 weight 1 minconn 1 maxconn 3 check inter 40000 listen stats :8888 mode http transparent stats uri /haproxy-stats stats realm Haproxy \\ statistic stats auth admin: admin

Fourth, start haproxy # start haproxy
# /usr /local /haproxy /sbin /haproxy -f /usr/local/haproxy/haproxy.cfg

see if Start
[zhangy@BlackGhost haproxy]$ ps -e
Copyright © Windows knowledge All Rights Reserved