keepalived+lvs 安装配置

2022/6/26 23:31:48

本文主要是介绍keepalived+lvs 安装配置,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

说明:
1、keepalived 做为双机热备软件,是为lvs而生的扩展项目;
2、通过VRRP 协议实现。让其能够对后端有健康检查的功能。

安装:
yum -y install ipvsadm
yum -y install keepalived

启动keepalived服务
systemctl start keepalived.service


keepalived-master配置:
################################
vim /etc/keepalived/keepalived.conf

! Configuration File for keepalived
global_defs {
notification_email {
acassen@firewall.loc
}


notification_email_from root@localhost
router_id LVS_01
vrrp_skip_check_adv_addr
vrrp_garp_interval 0
vrrp_gna_interval 0
}
vrrp_instance VI_1 {
state MASTER
interface ens192
virtual_router_id 10
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.100.1.101/24 dev ens192
}
}
virtual_server 10.100.1.101 443 {
delay_loop 3
lb_algo rr
lb_kind DR
persistence_timeout 50
protocol TCP

real_server 10.100.1.21 443 {
weight 1
TCP_CHECK {
connect_port 443
connect_timeout 5
retry 3
delay_before_retry 3
}
}
real_server 10.100.1.22 443 {
weight 1
TCP_CHECK {
connect_port 443
connect_timeout 5
retry 3
delay_before_retry 3
}
}
}
#######################################

keepalived-slave配置:
state SLAVE
virtual_router_id 51
priority 100

 



这篇关于keepalived+lvs 安装配置的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程