1. 程式人生 > >centos6 安裝 keepalived

centos6 安裝 keepalived

配置文件 kernel virt 默認 ast 2.6 configure ace rtu

安裝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 {
[email protected]
}

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