High Availability Cluster Experiment two: KEEPALIVED+LVS realization of fault self-migration

Source: Internet
Author: User

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/74/61/wKiom1YbhCGxktZ5AAF1mRFG9GI334.jpg "style=" float: none; "Title=" is not named. JPG "alt=" Wkiom1ybhcgxktz5aaf1mrfg9gi334.jpg "/>

First, to undertake the previous article, according to the above topology to do the modification:

1. Add a director,eth1 IP 192.168.1.5

2. The old director adds a network card eth0 (IP 10.0.0.1/24) directly connected to the new director's eth0 (IP 10.0.0.2/24)

3. Delete. Eth1:0 of the old director


Two, the director of the following operations:

1. Close the Ipvsadm:

Chkconfig Ipvsadm off

Service Ipvsadm off

2. Trust through Ssh-keygen

Ssh-keygen-t rsa-f ~/.ssh/idrsa-p "
Ssh-copy-id-i. ssh/idrsa.pub [Email protected]

3: Install keepalived

Yum-i Install Keepalvied

4. Setting up the configuration file

Attention:

(1) The red box is to be modified on the director of backup.

(2) There must be a space before all curly braces, otherwise there will be an exception, and it is not easy to troubleshoot.

Vim/etc/keepalived/keepalived.conf

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/74/61/wKiom1Ybh0ahYtvZAAG_iTsAryA728.jpg "title=" 1.png " alt= "Wkiom1ybh0ahytvzaag_itsarya728.jpg"/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/74/5E/wKioL1YbhD7g8hG6AAGFZGW5T-k311.jpg "style=" float: none; "title=" 2.png "alt=" Wkiol1ybhd7g8hg6aagfzgw5t-k311.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/74/61/wKiom1YbhCHhb_r3AADlZK5QmC8224.jpg "style=" float: none; "title=" 3.png "alt=" Wkiom1ybhchhb_r3aadlzk5qmc8224.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/74/61/wKiom1YbhD7y5xLyAAAxEdphEig850.jpg "style=" float: none; "title=" 2015-10-12_172204.png "alt=" Wkiom1ybhd7y5xlyaaaxedpheig850.jpg "/>

5. Create a script for state change run (can be created according to actual needs, here only one test example)

vim/etc/keepalived/status.sh

#!/bin/bash

echo "' Date ' +%f%T" Change status to $ >>/etc/keepalived/status.txt

chmod +x/etc/keepalived/stauts.sh

6. Start the service

Service keepalived Start

Chkconfig keepalived on



First old director for Master


Experiment:

    1. Creating a file on the old director (Touch/etc/keepalived/down) becomes backup (the priority is changed from 100 to 90) and the system automatically runs the script/etc/keepalived/status.sh 192.168.1.1 Backup, automatically write status changes into the Status.txt file, you can view the current keepalived mode status through Tail-f/etc/keepalived/status.txt

    2. Rm-f/etc/keepalived/down, the old director becomes master again.

    3. When the old director's eth1 is disconnected, the old director becomes Master, and the new director becomes fault

    4. Move the home page on the httpd server: MV index.html Index.html.bak, Ipvsadm on director can see that this httpd server is removed.





This article is from the "Xin-Lu-li-cheng" blog, please make sure to keep this source http://orzorz.blog.51cto.com/4228156/1702201

High Availability Cluster Experiment two: KEEPALIVED+LVS realization of fault self-migration

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.