Test method: when the client accesses the VIP, haproxy distributes the access request to the backend WEB Server Based on the configured scheduling algorithm and weight, thus implementing the load balancing function.3) Haproxy + Keepalived failover Test
Test method: When the backend WEB server goes down, haproxy automatically detects and sends the request to the
, and we use the CentOS 6 system as an example to install the system's own package directly.# yum Install-y haproxy
# haproxy-v
ha-proxy version 1.5.4 2014/09/02Second, prepare the Haproxy configuration filecd/etc/haproxy vimhaproxy.cfg Global log127.0.0.1local2 chroot/var/lib/ha
://haproxy.1wt.eu/download/1.4/src/haproxy-1.4.24.tar.gz Tar xf haproxy-1.4.24.tar.gz cd haproxy-1.4.24 view ubuntu version info: uname-a display: linux ubuntu37 3.2.0-51-generic # 77-Ubuntu SMP Wed Jul 24 20:18:19 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux make TARGET = 37-ubuntu make PREFIX =/usr/local/
can set stats auth Frank by yourself: frank stats hide-version stats admin if TRUE
(3) create a log file/var/log/haproxy. log
cd /var/logmkdir haproxycd haproxytouch haproxy.logchmod a+w haproxy.log
(4) Enable the haproxy Logging Function of rsyslog
Vim/etc/rsyslog. cnf -- modify the rsyslog. cfg file $ ModLoad imudp $ UDPServerRun 514 and remove the # before the two rows. In local7. */var/log/boot. add th
"Stop keepalived"> /dev/nullfifi#chomd +x /etc/keepalived/check_haproxy.sh
6. Haproxy + Keepalived high availability test.1) Haproxy + Keepalived high availability test.
Test method: Stop the keepalived Service of the master node, view the backup keepalived log, and find that when the master node is down, the slave node role will immediately become the master node, enabling the VIPS protocol, and immediate
{stateMASTERinterfaceeth1virtual_router_id51mcast_src_ip192.168.233.84priority99advert_int1authentication{auth_typePASSauth_pass876543}virtual_ipaddress{192.168.233.90}}3. Start and create the keepalived service on node01 and node02. 1) start the service and enable it upon startup:
servicekeepalivedstartchkconfig--addkeepalivedchkconfigkeepalivedon
2) test and observe the VIP drift (1) VIP address observation
HOST: Observe the VIP address as follows:
[[emailprotected]/]#servicekeepalivedstartSta
:
/Usr/local/haproxy/sbin/haproxy-F/usr/local/haproxy/etc/haproxy. cfg
3. Install keepalived:
1. First install 172.20.27.40:
1.1 installation
Tar zxvf keepalived-1.1.17.tar.gz
CD keepalived-1.1.17
./Configure
Make
Make install
CP/usr/local/etc/rc. d/init. d/keepalived/etc/rc. d/init. d
CP/usr/local/etc/sysconfig/keepal
Rotten mud: keyword introduction of high load balancing learning haproxy, load balancing haproxy
This document consistsIlanniwebProviding friendship sponsorship, first launched in the dark world
In the previous article, we briefly explained the installation and Setup of haproxy. In this article, we will introduce the keywords used in the
Rotten mud: TCP application for learning haproxy with high load balancing, and load balancing haproxy
This document consistsIlanniwebProviding friendship sponsorship, first launchedThe world
In the previous articles, we introduced the configuration parameters of haproxy, And the configuration examples are all http protocol (layer-7 Application.
This article int
refresh 30 s# Statistics page urlStats uri/admin? Stats# Prompt text in the password box on the statistics pageStats realm haproxy \ statistics# User name and password settings on the statistics pageStats auth admin: Admin# Hide the haproxy version on the statistics pageStats hide-version########################### TCP connection monitoring configuration #######
Haproxy achieves load balancing and dynamic/static Separation
After haprxy Server Load balancer and dynamic/static separation, haproxy is more professional in these two aspects than nginx, including session persistence, cookie guidance, and url monitoring backend, mysql Server Load balancer is not available in nginx, but it cannot be said that haprox can replace
for 4-layer message forwardingOption Httplog #日志类别, using HttplogOption DontlognullOption Forwardfor #如果后端服务器需要获得客户端真实ip需要配置的参数, you can get the client IP from the HTTP headerOption Httpclose #每次请求完毕后主动关闭http通道, Haproxy does not support keep-alive, only simulates the implementation of this patternRetries 3 #3次连接失败就认为服务器不可用, mainly through the following check checksOption Redispatch #当serverid对应的服务器挂掉后, Force directed to other health serversMaxconn #最
-host hot backup, supports virtual hosts, has a very good server health check function, when the back-end server of the proxy fails, HAProxy will automatically remove the server and automatically add the server after the fault is restored. It also provides an intuitive monitoring page, the service cluster running status can be clearly monitored in real time.
In the new version 1.3, frontend and backend conf
corresponding to the serverId is forcibly redirected to another server after it fails.
Retries 3 -- defines that the server is unavailable when the connection fails three times.Timeout http-request 10 sTimeout queue 1 mTimeout connect 10 s -- server connection timeoutTimeout client 1 m -- client Connection timeoutTimeout server 1 m -- server connection timeoutTimeout http-keep-alive 10 s -- persistent connectionTimeout check 10 s -- heartbeat check timeoutMaxconn 3000
Listen admin_status -- cu
connected, and then withdrew again, found that even another machine, here, we found that the experiment has been successful. But as a programmer you are still unwilling, we have to monitor, we also want to view the log. Here we go.
Configuration MonitoringHaproxy with the monitoring function, and simple configuration, directly in the main configuration file to add a configuration, the format is so indented, not a copy of the problem. This configura
server db1 10.1.6.203: 3306 weight 1 check port 9222 inter 12000 rise 3 fall 3 server db2 10.1.6.205: 3306 weight 1 check port 9222 inter 12000 rise 3 fall 3 listen haproxy_stats mode http bind 10.1.6.173: 8888 option httplog stats refresh 5S stats uri/status stats realm Haproxy Manager stats auth admin: p @ a1SZs24
2. Install xinetd
root@10.1.6.203:~# apt-get install xinetd
3. Add the xinetd service script and mysqlchk port number to each node.
Root
:1080# Port statsuri/admin-status# Monitoring uristatsauthadmin :admin #用户用: Password modehttpoptionhttplogfrontendmainbind *:80aclnBSP;WEBNBSP;HDR (host) -iwww.abc.com #acl后面是规则名称,-I ignores case, followed by the domain name to be accessed, If you access the domain name www.abc.com, the Web rule is triggered. NBSP;NBSP;ACLNBSP;IMGNBSP;HDR (host) -iimg.abc.comuse_backendwebserver ifweb #如果上面定义的web规则被触发, which accesses www.abc.com, distributes the req
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.