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:
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
Rm-f/etc/keepalived/down, the old director becomes master again.
When the old director's eth1 is disconnected, the old director becomes Master, and the new director becomes fault
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