Haproxy Cluster Service Building
-install the service package-
Yum install pcre-devel bzip2-devel gcc gcc-c++-ytar zxvf haproxy-1.5.19.tar.gz-C / optcd / opt/haproxy-1.5.19/make TARGET=linux26make install
-- modify configuration file-
Mkdir / etc/haproxycp / opt/haproxy-1.5.19/examples/haproxy.cfg / etc/haproxy/vim / etc/haproxy/haproxy.cfg
# chroot / usr/share/haproxy / / imprison the share directory
# redispatch / / resend repeatedly
-Delete all listen and add the following paragraph-
Listen webcluster 0.0.0.0 listen webcluster 80 / / allows any network to access the website option httpchk GET / index.html / / defines the default home page type balance roundrobin / / load balancing algorithm, polls server inst1 192.168.218.130 server inst1 2000 fall 3 / / defines the online node server inst2 192.168.218.131 listen webcluster 80 check inter 2000 fall 3
-create a startup connection and start the service--
Cp / opt/haproxy-1.5.19/examples/haproxy.init / etc/init.d/haproxychmod 755 / etc/init.d/haproxy chkconfig-- add haproxy / / Boot ln-s / usr/local/sbin/haproxy / usr/sbin/haproxysystemctl start haproxy.servicesystemctl stop firewalld.servicesetenforce 0