Install the haproxy and haproxy commands and the haproxy commands
Directory:1. Install haproxy2. haproxy command
1. Install haproxy
CentOS comes with haproxy, but the version may be old. You can find the latest stable version of
Authentication {
Auth_type Pass
Auth_pass 1111
}
Track_script {
Chk_haproxy #监测haproxy进程状态
}
virtual_ipaddress {
192.168.21.253
}
Notify_master the ARP record of the "/etc/keepalived/clean_arp.sh 192.168.21.253" #更新虚拟服务器 (VIP) address to the gateway
}
Vrrp_instance Vi_2 {
State BACK
Weight
Check Method:
Option httpchk
Option httpchk
Option httpchk
Option httpchk
For example:
Backend https_relay
Mode tcp
Option httpchk OPTIONS * HTTP/1.1 \ r \ nHost: \ www.ilanni.com
Server apache1 192.168.1.1: 443 check port 80
9Keyword stats enable
Stats enable enables statistical reports set by default during program compilation. stats enable cannot be used in frontend segments. As long as there are no other settings, they will use the following Configuration:
Stats uri:/stats
Stats
Interface eth0
Virtual_router_id 51
Priority104 # Change from keepalived to 100, as long as it is smaller than the master, and the number is from 0 ~ 255. the greater the number, the greater the weight.
Advert_int 1
Authentication {
Auth_type PASS
Auth_pass 1111
}
Track_script {
Chk_http_port
}
Virtual_ipaddress {
192.168.207.141
}
}
Notes:
1. you must add executable permissions to/etc/keepalived/checkHaproxy. sh, such as chmod + x/etc/keepalived/c
Haproxy configuration for Server Load balancer and haproxy configuration for Server Load balancerCommon Open-Source Software load balancers include Nginx, LVS, and Haproxy. Comparison of three major software load balancers (LVS Nginx VS Haproxy)
I. LVS:1. Strong load resistance. Strong load resistance and high performa
haproxy+keepalived Build WEB Cluster We have learned two Web cluster software nginx and LVS, they have their own characteristics, this chapter will introduce another cluster software haproxy, we will be on its scheduling algorithm, cluster environment, as well as the configuration of the cluster to explain. Haporxy is currently a more popular scheduling tool, the previous study of the LVS configuration is r
This article is suitable for beginners, because it was set up step by step and has never been used before. Problems Encountered during this period are displayed.
I. installation environment:
Because the system I installed is CentOS6.3 basic, many dependency packages are not installed. Therefore, some errors may occur during the installation process. You need to install the dependency package, to help you better understand the solutions for different errors, I will list the solutions for each err
haproxy01, after keepalived in haproxy02 is started, vip2 automatically jumps to eth0 in haproxy02.) the installation of the host haproxy02: keepalived is the same as that of keepalived. conf: ######## keepalived. conf ######## global_defs {router_id LVS_DEVEL} vrrp_instance VI_1 {state BACKUP # haproxy01: MASTER interface eth0 virtual_router_id 51 priority 90 # smaller than haproxy01 advert_int 1 authentication {auth_type PASS auth_pass 123456789} v
roundrobin server mysql-1 10.0.0.1:3306 check server mysql-2 10.0.0.2:3306 checkUnlike HTTP load balancing HAProxy doesn ' t has a specific "mode" for MySQL so we use TCP. We ' ve set HAProxy to listen-only in the loopback address (assuming that application are on the same server) however if your Application resides on a different droplet make it listen on 0.0.0.0 or the private IP address.We need on
:
/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
, 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
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
Fall 5
Server web2 192.168.5.57:8080 Cookie app1inst2 check Inter rise 2 Fall 5
4, Backup installation keepalived, steps are not introduced, keepalived.conf file content on two changes, red font marked out
Copy Code code as follows:
! Configuration File for Keepalived
Global_defs {
router_id Lva_devel
}
Vrrp_script Chk_http_port {
Script "/root/check_haproxy.sh"
Interval 2
Weight 2
}
Vrrp_instance Vi_1 {
State BACKUP
Interface eth0
VIRTUAL_ROUTER_ID 5
{
Auth_type Pass
Auth_pass 141
}
virtual_ipaddress {
192.168.10.141/26 Dev eth0
}
}
Vrrp_instance vi_142 {
State BACKUP
Interface eth0
VIRTUAL_ROUTER_ID 142
Priority 50
Advert_int 1
Authentication {
Auth_type Pass
Auth_pass 142
}
virtual_ipaddress {
192.168.10.142/26 Dev eth0
}
}
At first glance, the host and standby configuration file is the same, carefully look at the value of priority, use the following command to join th
server, the policy is static)
Deploy haproxy1. Installation# Wget http://haproxy.1wt.eu/download/1.4/src/haproxy-1.4.20.tar.gz# Tar zcvf haproxy-1.4.20.tar.gz# Cd haproxy-1.4.20# Make TARGET = linux26 ARCH = x86_64# Make install PREFIX =/usr/local/haproxy
2. configurationMk
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.