keepalived

配置server4,ip 为172.25.77.4

1.首先将keepalived的压缩包进行解压
这里写图片描述
2.从网上获取libnfnetlink-devel-1.0.0-1.el6.x86_64.rpm安装包,并进行如下操作。
这里写图片描述

yum install openssl-devel libnfnetlink-devel-1.0.0-1.el6.x86_64.rpm -y
yum install gcc-c++ -y
cd /root/keepalived
./configure --prefix=/usr/local/keepalived --with-init=SYSV
make && make install
ln -s /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/
ln -s /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/
ln -s /usr/local/keepalived/etc/keepalived/ /etc/
ln -s /usr/local/keepalived/sbin/keepalived /bin/
chmod +x /usr/local/keepalived/etc/rc.d/init.d/keepalived
scp -r keepalived/ 172.25.77.4:/usr/local/
ip addr del 172.25.77.100/24 dev eth0
/etc/init.d/ldirectord stop
chkconfig ldirectord off
yum install mail -y

4.在server4上进行查看
这里写图片描述
进行如下操作

ln -s /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/
ln -s /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/
ln -s /usr/local/keepalived/etc/keepalived/ /etc/
ln -s /usr/local/keepalived/sbin/keepalived /bin/
chmod +x /usr/local/keepalived/etc/rc.d/init.d/keepalived

5.更改server1上的keepalived配置,并发送给server4

yum install ipvsadm -y
/etc/init.d ipvsadm start
 vim /etc/keepalived/keepalived.conf

这里写图片描述
这里写图片描述
这里写图片描述


/etc/init.d/keepalived start
scp keepalived.conf 172.25.77.4:/etc/keepalived

6.更改server4上的keepalived配置文件

yum install ipvsadm -y
/etc/init.d ipvsadm start
vim /etc/keepalived/keepalived.conf

其他都和server1配置一样,但是要将12行注释掉,20行改为
state BACKUP
这里写图片描述

/etc/init.d/keepalived restart

7.此时在server1上查看ip addr,vip绑定在server1上
这里写图片描述
在server1上执行ifdown eth0,vip会漂移到server4上
这里写图片描述
这里写图片描述
在server1上执行ifup eth0,server4上执行ifdown eth0
vip 又会从server4上漂移到server1上。
这里写图片描述
这里写图片描述
8.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值