KEEPALIVED 做LVS+HA实例安装与配置

本文涉及的产品
传统型负载均衡 CLB,每月750个小时 15LCU
网络型负载均衡 NLB,每月750个小时 15LCU
EMR Serverless StarRocks,5000CU*H 48000GB*H
简介: --------------------------------------master-------------------------------------------------------wget http://www.

--------------------------------------master-------------------------------------------------------
wget http://www.keepalived.org/software/keepalived-2.0.9.tar.gz
tar zxvf keepalived-2.0.9.tar.gz
cd keepalived-2.0.9
./configure --perfix=/ --mandir=/usr/local/share/man
make &&make install
cp keepalived/etc/init.d/keepalived.rh.init /etc/init.d/keepalived
chmod +x /etc/init.d/keepalived
cp keepalived/etc/init.d/keepalived.sysconfig /etc/sysconfig/keepalived
chkconfig --add keepalived
chkconfig --level 345 keepalived on

编辑

vi /etc/sysconfig/keepalived
global_defs {
notification_email {
finalsd@gmail.com
}
notification_email_from finaxx@gmail.com
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id haproxy-ha
}
vrrp_sync_group VG1 {
group {
VI1
}
}
vrrp_instance VI1 {
state BACKUP
smtp_alert
notify_fault "/root/script/notify_mail.sh fault"
notify_master "/root/script/notify_mail.sh master"
nopreempt
insterface eth1

track_interface {
eth 0
eth 1
}
virtual_router_id 51
priority 150
advert_int 1
authentication {
auth_type PASS
auth_pass abc123..
}
virtual_ipaddress {
192.168.1.1/24 dev eth1 scope global
}
}
virtual_server 192.168.1.1 80 {
delay_loop 3
lb_algo wlc #rr wrr
lb_kind DR
persistence_timeout 1200
protocol TCP
ha_suspend

real_server 192.168.1.11 80 {
weight 3
TCP_CHECK {
connect_timeout 3
connect_port 80
}
}
real_server 192.168.1.12 80 {
weight 3
TCP_CHECK {
connect_timeout 3
connect_port 80
}
}
}

service keepalived start

--------------------------------------backup-------------------------------------------------------
wget http://www.keepalived.org/software/keepalived-2.0.9.tar.gz
tar zxvf keepalived-2.0.9.tar.gz
cd keepalived-2.0.9
./configure --perfix=/ --mandir=/usr/local/share/man
make &&make install
cp keepalived/etc/init.d/keepalived.rh.init /etc/init.d/keepalived
chmod +x /etc/init.d/keepalived
cp keepalived/etc/init.d/keepalived.sysconfig /etc/sysconfig/keepalived
chkconfig --add keepalived
chkconfig --level 345 keepalived on

编辑

vi /etc/sysconfig/keepalived
global_defs {
notification_email {
finalsd@gmail.com
}
notification_email_from finaxx@gmail.com
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id haproxy-ha
}
vrrp_sync_group VG1 {
group {
VI1
}
}
vrrp_instance VI1 {
state BACKUP
smtp_alert
notify_fault "/root/script/notify_mail.sh fault"
notify_master "/root/script/notify_mail.sh master"
insterface eth1

track_interface {
eth 0
eth 1
}
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass abc123..
}
virtual_ipaddress {
192.168.1.1/24 dev eth1 scope global
}
}
virtual_server 192.168.1.1 80 {
delay_loop 3
lb_algo wlc #rr wrr
lb_kind DR
persistence_timeout 1200
protocol TCP
ha_suspend

real_server 192.168.1.11 80 {
weight 3
TCP_CHECK {
connect_timeout 3
connect_port 80
}
}
real_server 192.168.1.12 80 {
weight 3
TCP_CHECK {
connect_timeout 3
connect_port 80
}
}
}


相关实践学习
SLB负载均衡实践
本场景通过使用阿里云负载均衡 SLB 以及对负载均衡 SLB 后端服务器 ECS 的权重进行修改,快速解决服务器响应速度慢的问题
负载均衡入门与产品使用指南
负载均衡(Server Load Balancer)是对多台云服务器进行流量分发的负载均衡服务,可以通过流量分发扩展应用系统对外的服务能力,通过消除单点故障提升应用系统的可用性。 本课程主要介绍负载均衡的相关技术以及阿里云负载均衡产品的使用方法。
目录
相关文章
|
5月前
|
运维 算法 Linux
LVS详解(四)——LVS安装与配置命令
LVS详解(四)——LVS安装与配置命令
119 2
|
1月前
|
运维 负载均衡 网络协议
LVS+Keepalived 负载均衡
LVS+Keepalived 负载均衡
51 8
LVS+Keepalived 负载均衡
|
28天前
|
域名解析 运维 负载均衡
LVS+Keepalived 负载均衡(二)28-1
【8月更文挑战第28天】LVS+Keepalived 负载均衡 配置 LVS VIP
55 5
|
3月前
|
网络协议 应用服务中间件 Linux
LVS介绍与配置
LVS介绍与配置
146 8
|
3月前
|
负载均衡 网络协议 算法
使用IPVSADM配置LVS负载均衡
使用IPVSADM配置LVS负载均衡
|
5月前
|
运维 负载均衡 监控
keepalived+LVS实现高可用性集群
通过结合keepalived和LVS,你可以创建一个高可用性的负载均衡集群,确保服务器的稳定性和性能。这对于托管Web服务、应用服务器等关键服务的服务器集群非常有用。
113 1
|
5月前
|
负载均衡 监控 Linux
CentOS6.5高可用集群LVS+Keepalived(DR模式)
CentOS6.5高可用集群LVS+Keepalived(DR模式)
|
5月前
|
负载均衡 监控 调度
Keepalived+Lvs(dr)调度器主备配置小实验
Keepalived和LVS(Linux Virtual Server)是两个常用的开源软件,通常结合使用以提供高可用性和负载均衡的解决方案。 Keepalived是一种用于实现高可用性的软件,它可以监控服务器的健康状态,并在主服务器出现故障时自动切换到备份服务器。
190 2
|
11月前
|
负载均衡 算法 网络协议
Keepalived+LVS搭建高可用负载均衡
Keepalived+LVS搭建高可用负载均衡
336 1
|
10月前
|
负载均衡 网络协议 Linux
小白带你学习linux的keepalived+lvs和keepalived双机热备(三十七)
小白带你学习linux的keepalived+lvs和keepalived双机热备(三十七)
157 0