LVS + keepalived

Source: Internet
Author: User

Environment:

Centos6.4 64bit

Ipvsadm-1.24.tar.gz

Keepalived-1.1.19.tar.gz


IP deployment:

VIP: 172.16.100.5

Dip1: 172.16.100.1

Dip2: 172.16.100.2

Rip1: 172.16.100.3

Rip2: 172.16.100.4


Ing VIP on the firewall


Installation:

Ln-S/usr/src/kernels/2.6.32-358. el6.x86 _ 64 // usr/src/Linux

Tar zxvf ipvsadm-1.24.tar.gz

CD ipvsadm-1.24

Make & make install



Tar zxvf keepalived-1.1.19.tar.gz

Yum install OpenSSL-devel popt-devel

CD keepalived-1.1.19

./Configure

Make

Make install


CP/usr/local/etc/rc. d/init. d/keepalived/etc/rc. d/init. d/

CP/usr/local/etc/sysconfig/keepalived/etc/sysconfig/

Mkdir/etc/keepalived

CP/usr/local/etc/keepalived. CONF/etc/keepalived/

CP/usr/local/sbin/keepalived/usr/sbin

Service keepalived start

Installation is complete.

Configure RealServer:

#! /Bin/bash

VIP = 172.16.100.5

./Etc/init. d/functions

Case "$1" in

Start)

/Sbin/ifconfig lo: 0 $ VIP netmask 255.255.255.255 broadcast $ VIP

/Sbin/route add-host $ VIP Dev lo: 0

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

Echo "RealServer start OK"

;;

Stop)

Ifconfig lo: 0 down

/Sbin/route del $ VIP>/dev/null 2> & 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 stop OK"

;;

*)

Echo "Usage: $0 {START | stop }"

Exit 1

Esac

Exit 0

Configuration complete.


Configure the server Load balancer:



This article is from the "frequently used documentation" blog, please be sure to keep this source http://yujianglei.blog.51cto.com/7215578/1571848

LVS + keepalived

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.