• 高可用集群实验二keepalived+lvs实现故障自迁移

  • 发布时间:2016-01-13 16:44 | 作者:yc | 来源:互联网 | 浏览:1200 次
  • 高可用集群实验二keepalived+lvs实现故障自迁移

    这篇文章出自 “辛-碌-力-成” 博客,请必须保存此出处http://orzorz.blog.51cto.com//

    650) this.width=650;" src="/html/uploads/allimg/160113/1645024911-0.jpg" style="float:none;" title="未命名.JPG" alt="wKiom1YbhCGxktZ5AAF1mRFG9GI334.jpg" />

    一、承接上一篇文章,按上面拓扑做修正:

    1.新增一台Director,eth1的IP 192.168.1.5

    2.旧Director增添一同网卡eth0(IP 10.0.0.1/24)直连新Director的eth0(IP 10.0.0.2/24)

    3.删去.旧Director的eth1:0

    二、两台Director都进行以下操作:

    1.封闭ipvsadm:

    chkconfig ipvsadm off

    service ipvsadm off

    2..颠末ssh-keygen互信(可省)

    ssh-keygen -t rsa -f ~/.ssh/id_rsa -P ''

    ssh-copy-id -i .ssh/id_rsa.pub

    3..装配keepalived

    yum -i install keepalvied

    高可用集群实验二keepalived+lvs实现故障自迁移4.设置设置设置设备摆设摆设文件

    把稳:

    (1)红框是在backup的director上要进行修正的

    (2)统统大年夜括号前必须有空格,不然会有反常,且不好排查

    高可用集群实验二keepalived+lvs实现故障自迁移

    vim /etc/keepalived/keepalived.conf

    650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/74/61/wKiom1Ybh0ahYtvZAAG_iTpt电子游艺送11sAryA728.jpg" title="1.png" alt="wKiom1Ybh0ahYtvZAAG_iTsAryA728.jpg" />

    650) this.width=650;" src="/html/uploads/allimg/160113/1645021594-3.jpg" style="float:none;" title="2.png" alt="wKioL1YbhD7g8hG6AAGFZGW5T-k311.jpg" />

    650) this.width=650;" src="/html/uploads/allimg/160113/164502M00-4.jpg" style="float:none;" title="3.png" alt="wKiom1YbhCHhb_r3AADlZK5QmC8224.jpg" />

    650) this.width=650;" src="/html/uploads/allimg/160113/1645025423-5.jpg" style="float:none;" title="2015-10-12_.png" alt="wKiom1YbhD7y5xLyAAAxEdphEig850.jpg" />

    5.创立状况篡改运转的脚本(可根据实际必要创立,这儿只供给一个测验比如)

    vim /etc/keepalived/status.sh

    #!/bin/bash

    echo "`date ‘+%F %T’`$1 change status to $2 " >>/etc/keepalived/status.txt

    chmod +x /etc/keepalived/stauts.sh

    6.发动效劳

    service keepawww.81444.comlived start

    chkconfig keepalived on

    一开始旧Director为master

    试验:

    在旧Director上创立文件(touch /etc/keepalived/down)则会成为backup(优先级由原先的100成为了90),而且体系主动运转脚本/etc/keepalived/status.sh 192.168.1.1 backup ,主动将状况篡改写进status.txt文件里,就可颠末tail -f /etc/keepalived/status.txt 反省当前keepalived的形式状况

    rm -f/etc/keepalived/down ,则旧Director又成为master

    将旧Director的eth1断开,则旧Director又成为master,而新Director成为fault

    在httpd效劳器大年夜将主页移走:mv index.html index.html.bak ,Director的上ipvsadm能够看到将此httpd效劳器移除

  • 相关内容

友情链接: