Failover 故障转移 VRRP : 故障转移 IP的协议
可靠服务=冗余服务
安装方法:可参考 keepalived源码下的INSTALL文件 配置文件方法: 可参考man 安装目录下/share/man/man5 (配置文件参数)与 man8(命令选项参数)
TOP HIERACHY GLOBAL CONFIGURATION VRRPD CONFIGURATION LVS CONFIGURATION
yum源
wget http://www.keepalived.org/software/keepalived-1.3.5.tar.gz
tar zxf keepalived-1.3.5.tar.gz
yum -y install gcc gcc-c++ gcc-g77 ncurses-devel bison libaio-devel cmake libnl libpopt popt-static openssl-devel libnfnetlink-devel
./configure --prefix=/usr/local/keepalived
aclocal autoheader automake --add-missing autoreconf
make && make install
自启动脚本:
其他 工具 killall => yum install -y psmisc
vrrp_script chk_mycat { script "pidof mycat interval 5 weight -5 }
vrrp_instance VI_1 { interface eth0 state MASTER priority 100
shared by both nodes
virtual_router_id 33
authentication {
auth_type PASS auth_pass hello }
track_script { chk_mycat virtual_ipaddress { 192.168.1.120 } }
notify_master /when_i_turn_into_master_exec_me.sh }
this is the secondary server
vrrp_instance VI_1 { interface eth0 state BACKUP priority 200
shared by both nodes
virtual_router_id 33
authentication {
auth_type PASS auth_pass hello }
track_script { chk_mycat }
notify_master /when_i_turn_into_master_then_exec_me.sh }