Keepalived Reality Web dual standby (high availability)

Source: Internet
Author: User

Keepalived Reality Web dual standby (high availability)

by implementing keepalived high availability on both master and standby schedulers, the single point of failure of the scheduler is resolved

The LVS is configured on the Master and Standby scheduler , and the main scheduler works normally

When the main scheduler is abnormal,keepalived enables the standby scheduler, which guarantees high availability of the scheduler

Scheduler guarantees high availability of background services

keepalived mechanism assigns the same IP to the same Web Server

high availability of the Web server is implemented as follows :

web1:192.168.10.20 Master

web2:192.168.10.22 Preparation

Virtual IP: 192.168. 1 0.100

client:192.168.10.40

One, install keepalived on two Web servers

# yum install-y gcc gcc-c++ kernel-devel openssl-devel popt-devel

# tar Xvzf keepalived-1.2.7.tar.gz-c/usr/src/

# cd/usr/src/keepalived-1.2.7/

# Uname-r

2.6.32-358.el6.x86_64

#./configure--sysconf=/etc--with-kernel-dir=/usr/src/kernels/2.6.32-358.el6.x86_64/&& make && Make install

Note:

--sysconf //keepalived main profile storage location /etc/keepalived/keepalived.conf

--with-kernel-dir // Specify the location of the kernel files that the server is using

#ln-S/usr/local/sbin/keepalived/sbin/

# Chkconfig keepalived on


Second, keepalived Configuration Instructions

Web1 Server:

Vim/etc/keepalived/keepalived.conf

Set up alert messages

Global_defs {

Notification_email {

Root @ localhost // Sender Mailbox

}

Notification_email_from root@192.168.10.40 // recipient mailbox , set here to send to yourself

Smtp_server192.168. 1 0. who to send e-mail to

Smtp_connect_timeout 30

router_id Lvs_devel

}

VRRP Instance Settings

vrrp_instancevi_1 {

State Master // Primary server writes master, auxiliary backup is written SLAVE

Interface eth0

VIRTUAL_ROUTER_ID 51

Priority // Primary server precedence is higher than backup example: The Lord is 100.

Advert_int 1// primary and standby server How long is the time of mutual detection here is 1 seconds

Authentication {

Auth_type Pass

Auth_pass redhat // primary and secondary server passwords must be the same

}

virtual_ipaddress { 192.168. 1 0.100 }//Specify VIP virtual IP on the scheduler

}

Note: As long as the above content , All the others are deleted.

web2 server: Standby

Vim/etc/keepalived/keepalived.conf

Set up alert messages

Global_defs {

Notification_email {

Root @ localhost // Sender Mailbox

}

Notification_email_from root@192.168.10.40 // recipient mailbox , set here to send to yourself

Smtp_server192.168. 1 0. who to send e-mail to

Smtp_connect_timeout 30

router_id Lvs_devel

}

VRRP Instance Settings

vrrp_instancevi_1 {

StateSLAVE // master server writes master, auxiliary backup is written SLAVE

Interface eth0

VIRTUAL_ROUTER_ID 51

Priority 80 // Primary server precedence is higher than backup example: The master is 100 .

Advert_int 1// primary and standby server How long is the time of mutual detection here is 1 seconds

Authentication {

Auth_type Pass

Auth_pass redhat // primary and secondary server passwords must be the same

}

virtual_ipaddress { 192.168. 1 0.100 }//Specify VIP virtual IP on the scheduler

}

Third, start the keepalived service on two Web servers

# service Keepalived Start

Four, view IP on two Web servers separately

# IP Addr Show eth0

virtual IP can be seen on web1 192.168.10.100

virtual IP cannot be seen on web2

V. Client Access

HTTP://192.168.10.100 can now access the content on the web1

VI. testing its high availability

turn web1 off; see IP on web1 and web2

virtual IP can be seen on web2 192.168.10.100

virtual IP cannot be seen on web1

Client Refresh page: The content on the WEB2 can be accessed at this time .

indicates that the backup server WEB2 is working.

available:# tail-f/var/log/messages Live View

This article is from the "Dave-Technology blog" blog, please be sure to keep this source http://davewang.blog.51cto.com/6974997/1853479

Keepalived Reality Web dual standby (high availability)

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.