cat /etc/hosts
172.16.8.20 fs1
172.16.8.21 fs2
172.16.8.22 fs
1、安装服务
yum -y install keepalived
yum install nfs-utils rpcbind -y
net.ipv4.ip_forward=1
net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.default.rp_filter=0
2、配置文件
! Configuration File for keepalived
global_defs {
router_id RSYNC_MASTER
}
vrrp_instance VI_1 {
state MASTER
interface eth1
virtual_router_id 60
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
172.16.8.120
}
}
virtual_server 192.16.8.120 873 {
delay_loop 6
lb_algo rr
lb_kind NAT
nat_mask 255.255.255.0
persistence_timeout 5
protocol TCP
real_server 172.16.8.20 873 {
weight 3
TCP_CHECK {
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
connect_port 873
}
}
real_server 172.16.9.21 873 {
weight 3
TCP_CHECK {
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
connect_port 873
}
}
}