首页 > 代码库 > centos6 安装 keepalived
centos6 安装 keepalived
安装keepalived
yum -y install kernel-devel
ln -s /usr/src/kernels/2.6.32-642.15.1.el6.x86_64/ /usr/src/linux
cd /usr/local/src/
wget http://www.keepalived.org/software/keepalived-1.2.20.tar.gz
tar -zxvf keepalived-1.2.20.tar.gz
cd keepalived-1.2.20
./configure
make && make install
生成keepalived 的启动命令
cp /usr/local/etc/rc.d/init.d/keepalived /etc/init.d/
配置启动脚本的参数:
cp /usr/local/etc/sysconfig/keepalived /etc/sysconfig/
配置文件默认路径:
mkdir /etc/keepalived
拷贝配置文件到默认路径:
cp /usr/local/etc/keepalived/keepalived.conf /etc/keepalived/
cp /usr/local/sbin/keepalived /usr/sbin/
/etc/init.d/keepalived start
ps -ef |grep keepalived
cd /etc/keepalived/
cp keepalived.conf keepalived.conf.default
vim keepalived.conf
: notification_email {
test@qq.com
}
router_id LVS_01
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
priority 150
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.1.190/24 (2台机都一样,是ip addr 添加的虚拟IP)
}
}
/etc/init.d/keepalived start
ip addr add 192.168.1.190/24 dev eth0
ip addr
ip add|grep 192.168.1.190(只能在一台机有结果输出,不然就是裂脑了)
可以ping 同主,backup 有VIP(虚拟IP) 就认为是裂脑了
centos6 安装 keepalived