一、介绍
Keepalived提供了用于负载平衡和高可用性的框架。常见的架构模式有keepalived+lvs、keepalived+nginx、keepalived+mysql、keepalived+redis
二、分析
- 优点
- 方案成熟,使用量多
- 简单高效
- 缺点
- 无法支持毫秒级别切换,最小支持秒级别切换
三、安装
[root@0f350e880a3e /]# yum install keepalived -y
四、配置示例
virtual_server 193.168.29.10 80 {
delay_loop 6
lb_algo rr
lb_kind DR
nat_mask 255.255.255.0
persistence_timeout 50
protocol TCP
real_server 192.168.29.8 80 {
weight 1
TCP_CHECK {
connect_timeout 8
nb_get_retry 3
delay_before_retry 3
connect_port 80
}
}
real_server 192.168.29.5 80 {
weight 1
TCP_CHECK {
connect_timeout 8
nb_get_retry 3
delay_before_retry 3
connect_port 80
}
}
}
备注:配置文件需根据实际情况处理,参考文档:https://www.keepalived.org/doc/configuration_synopsis.html
留言