031_keepalive+nginx保证nginx高可用

一、

yum -y install keepalived
keepalived配置:

keepalived.conf:
vrrp_instance proxy {
state BACKUP
interface eth0
virtual_router_id 143
priority 99
advert_int 1
notify_master /opt/keepalive_script/arp_xxx.sh:
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.1.118
}
}


arp_xxx.sh:

#!/bin/bash
VIP=192.168.1.118
GATEWAY=192.168.1.1
/sbin/arping -I eth0 -c 5 -s $VIP $GATEWAY &>/dev/null

Reference:

http://gitbook.cn/books/59f435fb1925d95552720880/index.html

原文地址:https://www.cnblogs.com/itcomputer/p/9006071.html