安大
分类: LINUX
2013-02-22 16:12:03
原文地址:keepavlied配置安装 作者:cjshxxx
Keepalived安装配置
1.官网上面下载keepalived
(本次安装的是keepalived-1.1.14)
*注意:keepalived1.2或者别的高版本安装时,可能编译时会报错。和linux内核版本有关
2.编译安装:
tar zxvf keepalived-1.1.14.tar.gz
cd keepalived-1.1.14
./configure --prefix=/usr/local/keepalived/ --with-config-file=/usr/local/keepalived/conf/
Make && make install
3.修改配置:
cd keepalived-1.1.14
cp keepalived/etc/init.d/keepalived.sysconfig /etc/sysconfig/keepalived (keepalived启动时会调用)
cp keepalived/etc/init.d/keepalived.init /etc/init.d/keepalived (加入service启动项)
cp -r /usr/local/keepalived/etc/keepalived /etc/
4.修改配置文件/etc/keepalived/conf/keepalived.conf
点击(此处)折叠或打开
5.启动keepalived:
/etc/init.d/keepalived start
Starting keepalived: [ OK ]
ps aux |grep keepalived
root 5683 0.0 0.0 5032 564 ? Ss 11:07 0:00 keepalived -D
root 5684 0.0 0.0 5080 1416 ? S 11:07 0:00 keepalived -D
root 5685 4.0 0.0 5080 932 ? S 11:07 0:00 keepalived –D
6.使用 ip addr检测vip是否失效
Ip addr
eth0:
link/ether 00:50:56:98:00:07 brd ff:ff:ff:ff:ff:ff
inet 61.147.69.165/26 brd 61.147.69.191 scope global eth0
inet 192.168.0.244/32 scope global eth0
inet 192.168.0.223/32 scope global eth0
已经生效