Haproxy Load Balancer Web
650) this.width=650; "height=" 342 "src=" http://a4.qpic.cn/psb?/594581eb-e62e-4426-a878-953c87dd5729/ suj1slfp2wqz7foekuw0bjl6a*1fkp5xpwyqbju2tdi!/b/dgcbaaaaaaaa&ek=1&kp=1&pt=0&bo=kgjxaqaaaaadafs! &su=0225277713&tm=1481871600&sce=0-12-12&rf=2-9 "width=" 553 "style=" margin:0px;padding:0px; border-width:0px;border-style:none;vertical-align:top; "Alt=" dgcbaaaaaaaa&ek=1&kp=1&pt=0&bo= Kgjxaqaaa "/>
26.211 and 26.212 install Apache Web service omitted here
Yum Install-y httpd
Two Web pages created on Divisions 26.211 and 26.212
650) this.width=650; "height=" src= "http://a4.qpic.cn/psb?/594581eb-e62e-4426-a878-953c87dd5729/.8d6wg* Bmvphy6jqmshhmu5mujwmsxlvk45yyvx0tjs!/b/dmcaaaaaaaaa&ek=1&kp=1&pt=0&bo=jqjpaqaaaaadago!&su =0208682449&tm=1481871600&sce=0-12-12&rf=2-9 "width=" 548 "style=" margin:0px;padding:0px;border-width : 0px;border-style:none;vertical-align:top; "alt=" Dmcaaaaaaaaa&ek=1&kp=1&pt=0&bo=jqjpaqaaa "/>
650) this.width=650; "height=" 296 "src=" http://a4.qpic.cn/psb?/594581eb-e62e-4426-a878-953c87dd5729/ Mxmo2doe.t6cqllnjic7biia38odonnjfdbzchdbais!/b/dgcbaaaaaaaa&ek=1&kp=1&pt=0&bo=jqipaqaaaaadaco! &su=069285905&tm=1481871600&sce=0-12-12&rf=2-9 "width=" 548 "style=" margin:0px;padding:0px; border-width:0px;border-style:none;vertical-align:top; "Alt=" dgcbaaaaaaaa&ek=1&kp=1&pt=0&bo= Jqipaqaaa "/>
Installing the haproxy:1.5.4 on the 192.16.26.210
Yum Install–y Haproxy
650) this.width=650; "height=" 397 "src=" http://a4.qpic.cn/psb?/594581eb-e62e-4426-a878-953c87dd5729/ ksfd7t.l8vl9d5zbktmx5ym8m5ocg1odteptu5c14rg!/b/dgcbaaaaaaaa&ek=1&kp=1&pt=0&bo=kgkoaqaaaaadaii! &su=0128119649&tm=1481871600&sce=0-12-12&rf=2-9 "width=" 553 "style=" margin:0px;padding:0px; border-width:0px;border-style:none;vertical-align:top; "Alt=" dgcbaaaaaaaa&ek=1&kp=1&pt=0&bo= Kgkoaqaaa "/>
To edit the Haproxy configuration file:
Vim/etc/haproxy/haproxy.cfg
650) this.width=650; "height=" src= "http://a3.qpic.cn/psb?/594581eb-e62e-4426-a878-953c87dd5729/ 5tsqt59pvgwu.sy6trkwfje31wrusp.wtagloiazgas!/b/dgybaaaaaaaa&ek=1&kp=1&pt=0&bo=tafkaaaaaaadaaw! &su=058349633&tm=1481871600&sce=0-12-12&rf=2-9 "width=" 331 "style=" margin:0px;padding:0px; border-width:0px;border-style:none;vertical-align:top; "Alt=" dgybaaaaaaaa&ek=1&kp=1&pt=0&bo= Tafkaaaaa "/>
The contents of the configuration file are as follows:
#---------------------------------------------------------------------
# Example configuration for a possible Web application. See the
# Full configuration options online.
#
# Http://haproxy.1wt.eu/download/1.4/doc/configuration.txt
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# Global Settings
#---------------------------------------------------------------------
Global
# to has these messages end up In/var/log/haproxy.log you'll
# Need to:
#
# 1) Configure Syslog to accept network log events. This was done
# by adding the '-r ' option to the syslogd_options in
#/etc/sysconfig/syslog
#
# 2) Configure Local2 events to go to The/var/log/haproxy.log
# file. A line like the following can is added to
#/etc/sysconfig/syslog
#
# local2.*/var/log/haproxy.log
#
Log 127.0.0.1 Local2
Chroot/var/lib/haproxy
Pidfile/var/run/haproxy.pid
Maxconn 4000
User Haproxy
Group Haproxy
Daemon
# Turn on stats UNIX socket
Stats Socket/var/lib/haproxy/stats
#---------------------------------------------------------------------
# Common defaults that all the ' listen ' and ' backend ' sections would
# Use if not designated in their block
#---------------------------------------------------------------------
Defaults
Mode http
Log Global
Option Httplog
Option Dontlognull
Option Http-server-close
Option Forwardfor except 127.0.0.0/8
Option Redispatch
Retries 3
Timeout Http-request 10s
Timeout Queue 1m
Timeout Connect 10s
Timeout Client 1m
Timeout Server 1m
Timeout Http-keep-alive 10s
Timeout Check 10s
Maxconn 3000
#---------------------------------------------------------------------
# main frontend which proxys to the backends
#---------------------------------------------------------------------
#frontend Main *:5000
# ACL url_static path_beg-i/static/images/javascript/stylesheets
# ACL url_static path_end-i. jpg. gif. png. css. js
#
# use_backend Static If url_static
# Default_backend App
#
##---------------------------------------------------------------------
# # Static backend for serving up images, stylesheets and such
##---------------------------------------------------------------------
#backend Static
# balance Roundrobin
# Server static 127.0.0.1:4331 check
#
##---------------------------------------------------------------------
# # Round robin balancing between the various backends
##---------------------------------------------------------------------
#backend app
# balance Roundrobin
# Server App1 127.0.0.1:5001 Check
# Server APP2 127.0.0.1:5002 Check
# Server APP3 127.0.0.1:5003 Check
# Server APP4 127.0.0.1:5004 Check
Frontend websrv *:80
Default_backend webservers
Backend Webservers
Balance Roundrobin
Server Node2 192.168.26.211:80 Check
Server Node3 192.168.26.212:80 Check
Save exit:
Start the Haproxy service.
Service Haproxy Start
650) this.width=650; "height=" 217 "src=" http://a2.qpic.cn/psb?/594581eb-e62e-4426-a878-953c87dd5729/ r9vsonqnovdqcttrqrcg2mggot9reimjwwmh1xm4qt4!/b/daubaaaaaaaa&ek=1&kp=1&pt=0&bo=mghaaaaaaaadagq! &su=0171827681&tm=1481871600&sce=0-12-12&rf=2-9 "width=" 409 "style=" margin:0px;padding:0px; border-width:0px;border-style:none;vertical-align:top; "Alt=" daubaaaaaaaa&ek=1&kp=1&pt=0&bo= Mghaaaaaa "/>
Performed on 192.168.26.210: SS–TNLP #查看HAproxy是否监听80端口
650) this.width=650; "height=" 311 "src=" http://a4.qpic.cn/psb?/594581eb-e62e-4426-a878-953c87dd5729/ sx3wyxjktnszyexm59lc8jen8nxvobaabztywdwwnf0!/b/dgcbaaaaaaaa&ek=1&kp=1&pt=0&bo=kgi4aqaaaaadadq! &su=074480177&tm=1481871600&sce=0-12-12&rf=2-9 "width=" 553 "style=" margin:0px;padding:0px; border-width:0px;border-style:none;vertical-align:top; "Alt=" dgcbaaaaaaaa&ek=1&kp=1&pt=0&bo= Kgi4aqaaa "/>
Open Browser: Constantly refresh access 192.168.26.210 observation results
650) this.width=650; "height=" 236 "src=" http://a3.qpic.cn/psb?/594581eb-e62e-4426-a878-953c87dd5729/. 00aoatfobpej4brfl3ud3dtub0fcxeivp4hyqam.yq!/b/dgybaaaaaaaa&ek=1&kp=1&pt=0&bo=kgltaaaaaaadaoa! &su=051160753&tm=1481871600&sce=0-12-12&rf=2-9 "width=" 553 "style=" margin:0px;padding:0px; border-width:0px;border-style:none;vertical-align:top; "Alt=" dgybaaaaaaaa&ek=1&kp=1&pt=0&bo= Kgltaaaaa "/>
650) this.width=650; "height=" 184 "src=" http://a4.qpic.cn/psb?/594581eb-e62e-4426-a878-953c87dd5729/*a0mbzmkpr* cnhpv2wahi1*vdeabib.c2aa6uovh2je!/b/dgcbaaaaaaaa&ek=1&kp=1&pt=0&bo=kgk5aaaaaaadalq!&su= 0192110385&tm=1481871600&sce=0-12-12&rf=2-9 "width=" 553 "style=" margin:0px;padding:0px;border-width : 0px;border-style:none;vertical-align:top; "alt=" Dgcbaaaaaaaa&ek=1&kp=1&pt=0&bo=kgk5aaaaa "/>
This article is from the "on the Road" blog, please be sure to keep this source http://jdonghong.blog.51cto.com/3473478/1883368
Haproxy Load Balancer Web