LVS + Keepalived DR Mode

Source: Internet
Author: User
Tags haproxy

LVS + Keepalived DR Mode

Installation and deployment of LVS + Keepalived
 
Front-end master scheduling: IP address> 10.252.3.10
Frontend scheduling backup: IP> 10.252.3.11
VIP: 10.252.3.12
RealServer: 10.252.3.15
RealServer: 10.252.3.16
1: Install keepalivedipvsadm together with the master and slave nodes.
Yum installkeepalived ipvsadm-y
Note: You can use ipvsadm-Ln to view the LVS scheduling status.
 
 
========================================================== ========================================================== ====
2: Configure/etc/keepalived. conf.
The configuration of host 10.252.3.10 is as follows:
Vrrp_instanceVI_1 {
State MASTER # What is the difference between the MASTER and slave databases?
Interface eth1 # corresponding Nic
Virtual_router_id 60
Priority 101 # priority, who is the master (the greater the value, the higher the priority)
Advert_int 2
Authentication {# authentication method, and the password must be the same as the Master/Slave Password
Auth_type PASS
Auth_pass 1234 # Password
}
Virtual_ipaddress {# Switch Mode. Switch virtual IP Address
10.252.3.12/4
}
}
Virtual_server10.252.3.12 80 {# the corresponding port can be modified here
Delay loop 6 # health check time
Lb_algo rr # There are 12 balanced scheduling algorithms. The Round-Robin method is used here.
Lb_kind DR # There are three forwarding rules for Server Load balancer: NAT, DR, And TUN
Real_server 10.252.3.15 80 {
Weight 3
TCP_CHECK {# tcp polling check settings
Connect_timeout 3
Nb_get_retry 3
Delay_before_retry 3
Connect_port 80
}
}
Real_server 10.252.3.16 80 {
Weight 3
TCP_CHECK {# tcp polling check settings
Connect_timeout 3
Nb_get_retry 3
Delay_before_retry 3
Connect_port 80
}
}
}
 
Backup Machine configuration: 10.252.3.11
The keepalived configuration of Backup is mainly to modify two places, and the others are the same:
State BACKUP # What is the difference between the master and slave databases?
Priority 100 # priority, who is the master (the greater the value, the higher the priority)
========================================================== ========================================================== ====
3: run the script on realserver
Because DR is used, we need to deploy the DIP address and VIP address on the actual Virtual Machine for communication.
The script for compiling lvs_init.sh is as follows. The lvs_init scripts of the two backend VMS are the same:
#! /Bin/bash
# Description: Config realserver lo and apply noarp
SNS_VIP = 10.252.3.12
./Etc/rc. d/init. d/functions
Case "$1" in
Start)
Ifconfig lo: 0 $ SNS_VIP netmask000000000000255 broadcast $ SNS_VIP up # Set lo: 0 IP Address
/Sbin/route add-host $ SNS_VIP dev lo: 0 # add a route
Echo "1">/proc/sys/net/ipv4/conf/lo/arp_ignore
Echo "2">/proc/sys/net/ipv4/conf/lo/arp_announce
Echo "1">/proc/sys/net/ipv4/conf/all/arp_ignore
Echo "2">/proc/sys/net/ipv4/conf/all/arp_announce
Sysctl-p>/dev/null 2> & 1 # Update Configuration
Echo "RealServer Start OK"
;;
Stop)
Ifconfig lo: 0 down
Route del $ SNS_VIP>/dev/null2> & 1
Echo "0">/proc/sys/net/ipv4/conf/lo/arp_ignore
Echo "0">/proc/sys/net/ipv4/conf/lo/arp_announce
Echo "0">/proc/sys/net/ipv4/conf/all/arp_ignore
Echo "0">/proc/sys/net/ipv4/conf/all/arp_announce
Echo "RealServer Stoped"
;;
*)
Echo "Usage: $0 {start | stop }"
Exit 1
Esac
Exit 0
 
Grant the script permission chmod + x/data/script/lvs_init.sh
./Lvs_init start/stop run and stop scripts
Service keepalived start
Use ipvsadm-Ln to view lvs Server Load balancer. You can use webbech for testing.

Haproxy + Keepalived + Apache configuration notes in CentOS 6.3

Haproxy + KeepAlived WEB Cluster on CentOS 6

Keepalived + Haproxy configure high-availability Load Balancing

Haproxy + Keepalived build high-availability Load Balancing

Configure LVS + Keepalived + ipvsadm on CentOS 7

Keepalived high-availability cluster Construction

LVS/DR + Keepalived

LVS + Keepalived achieves layer-4 load and high availability

LVS + Keepalived high-availability server Load balancer cluster architecture Experiment

Heartbeat + LVS build a high-availability server Load balancer Cluster

Build an LVS load balancing test environment

A stress test report for LVS

Keepalived build highly available LVS Cluster

For more information about Keepalived, click here.
Keepalived: click here

This article permanently updates the link address:

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.