高可用4层lvs——keepalived
搭建方式:
node01:
ipvsadm -C
ifconfig eth0:2 down
---------------------------------
node01,node04安装keepalived
配置:
node01
/etc/keepalived/keepalived.conf
做个bak备份,再修改
vrrp 虚拟路由冗余协议
vrrp_instance VI_1 {
state MASTER //node04 BACKUP
interface eth0
virtual_router_id 51
priority 100 //node04 50
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.118.100/24 dev eth0 label eth0:3
}
}
real_server 192.168.118.12 80 { weight 1 HTTP_GET { url { path / status_code 200 } connect_timeout 3 nb_get_retry 3 delay_before_retry 3 } } real_server 192.168.118.13 80 { weight 1 HTTP_GET { url { path / status_code 200 } connect_timeout 3 nb_get_retry 3 delay_before_retry 3 } }