LVS-DR + keepalived high availability cluster

Source: Internet
Author: User
Tags node server

LVS + Keepalived high-availability cluster

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/052204H19-0.jpg "title =" 0812.jpg" alt = "180158660.jpg"/>

I,Configure the master Scheduler
1) LVSConfiguration:
[Root @ localhost ~] # Vim/etc/stsctl. conf
Add the following parameter: net. ipv4.conf. all. send_redirects = 0
Net. ipv4.conf. default. send_redirects = 0
Net. ipv4.conf. eth0.send _ redirects = 0
[Root @ localhost ~] # Sysctl-p
[Root @ localhost ~] # Modprobe ip_vs
[Root @ localhost ~] # Echo "modprobe ip_vs">/etc/rc. local
2) Install the supporting software.
Before compilation, you must install the kernel development kit kernel-devel openssl-devel popt-devel kernel SADM.
[Root @ localhost ~] # Yum-y install kernel-devel openssl-devel popt-devel
[Root @ localhost ~] # Rpm-ivh/misc/cd/Server/Packages/ipvsadm-1.25-9.e16.i686.rpm
3)Compile and install keepalived
[Root @ localhost ~] # Tar zxf keepalived-1.2.2.tar.gz
[Root @ localhost ~] # Cd keepalived-1.2.2
[Root @ localhost ~] #./Configure -- prefix =/-- with-kernel-dir =/usr/src/kernels/2.6.32-131
. 0.15.e16.i686
[Root @ localhost ~] # Make & make install
4)Use keepalivedService
[Root @ localhost ~] # Ls-l/etc/init. d/keepalived
-Rwxr-xr-x 1 root 1288 November 8 16.23/etc/init. d/keepalived
[Root @ localhost ~] # Chkconfig -- add keepalived
[Root @ localhost ~] # Chkconfig keepalived on

5)Configure keepalivedFile global configuration, hot standby configuration, etc.
[Root @ localhost ~] # Vim/etc/keepalived. conf
A)
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/0522042911-1.jpg "title =" 28.jpg" alt = "180926363.jpg"/>

B)Server pool Configuration
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/0522044441-2.jpg "title =" node. jpg "alt =" 181003140.jpg"/>

Start the keepalived Service
[Root @ localhost ~] # Service keepalived restart

Ii. Configure the slave Scheduler
1) LVSConfiguration:
[Root @ localhost ~] # Vim/etc/stsctl. conf
Add the following parameter: net. ipv4.conf. all. send_redirects = 0
Net. ipv4.conf. default. send_redirects = 0
Net. ipv4.conf. eth0.send _ redirects = 0
[Root @ localhost ~] # Sysctl-p
[Root @ localhost ~] # Modprobe ip_vs
[Root @ localhost ~] # Echo "modprobe ip_vs">/etc/rc. local
2) Install the supporting software.
Before compilation, you must install the kernel development kit kernel-devel openssl-devel popt-devel kernel SADM.
[Root @ localhost ~] # Yum-y install kernel-devel openssl-devel popt-devel
[Root @ localhost ~] # Rpm-ivh/misc/cd/Server/Packages/ipvsadm-1.25-9.e16.i686.rpm
3)Compile and install keepalived
[Root @ localhost ~] # Tar zxf keepalived-1.2.2.tar.gz
[Root @ localhost ~] # Cd keepalived-1.2.2
[Root @ localhost ~] #./Configure -- prefix =/-- with-kernel-dir =/usr/src/kernels/2.6.32-131
. 0.15.e16.i686
[Root @ localhost ~] # Make & make install
4)Use keepalivedService
[Root @ localhost ~] # Ls-l/etc/init. d/keepalived
-Rwxr-xr-x 1 root 1288 November 8 16.23/etc/init. d/keepalived
[Root @ localhost ~] # Chkconfig -- add keepalived
[Root @ localhost ~] # Chkconfig keepalived on

5)Configure keepalivedFile global configuration, hot standby configuration, etc.
[Root @ localhost ~] # Vim/etc/keepalived. conf
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/0522041214-3.jpg "title =" 1.jpg" alt = "181119220.jpg"/>
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/0522042Y3-4.jpg "title =" node. jpg "alt =" 181202546.jpg"/> Start the keepalived Service
[Root @ localhost ~] # Service keepalived restart

3. Configure webNode server (web1 web2)

1) Configure virtual IP address VIP) floating address

[Root @ localhost ~] # Cd/etc/sysconfig/network-scripts/

[Root @ localhost ~] # Cp ifcfgh-lo ifcfg-lo: 0

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/0522041004-5.jpg "title =" 11.jpg" alt = "181224140.jpg"/>

[Root @ localhost ~] # Ifup lo: 0

[Root @ localhost ~] # Vim/etc/rc. local
/Sbin/route add-host 200.0.0.254 dev lo: 0 // add route records

[Root @ localhost ~] # Route add-host 200.0.0.254 dev lo: 0

2) Adjust and proc response parameters sysctl. conf

[Root @ localhost ~] # Vim etc/sysctl. conf
Add the following parameter: net. ipv4.conf. all. arp_ignore = 1

Net. ipv4.conf. all. arp_announce = 2

Net. ipv4.conf. default. arp_ignore = 1

Net. ipv4.conf. default. arp_announce = 2

Net. ipv4.conf. lo. arp_ignore = 1

Net. ipv4.conf. lo. arp_announce = 2

[Root @ localhost ~] # Sysctl-p

[Root @ localhost ~] # Service httpd start

[Root @ localhost ~] # Chkconfig httpd on

3) Test the LVS Cluster

[Root @ localhost ~] # Ipvsadm-Ln



Email server
Note: When the sendmail mail server is installed on the scheduler, an email is sent to the specified mailbox of the scheduler whenever the web node is down or up.
1)Install On the master SchedulerSendmailService

[Root @ localhost ~] # Yum-y install sendmail

[Root @ localhost ~] # Service sendmail start

[Root @ localhost ~] # Chkconfig sendmail on

[Root @ localhost ~] # Useradd u1

[Root @ localhost ~] # Vim/etc/keepalived. conf

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/052204D33-6.jpg "title =" 0731.jpg" alt = "181351261.jpg"/>

[Root @ localhost ~] # Vim/etc/resolv. conf

Servicename dns1.beent.com

[Root @ localhost ~] # Vim/etc/hosts

127.0.0.1 dns1.benet.com

[Root @ localhost ~] # Cat/var/mail/u1 // view emails


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.