当前位置:网站首页>[cluster] lvs+keepalived high availability cluster
[cluster] lvs+keepalived high availability cluster
2022-06-11 07:34:00 【Sprite, don't be angry】
List of articles
Preface
The content of this blog is only to record the thoughts of bloggers , For reference only , Everything is subject to the results of their own practice .
One 、LVS+keepalived
1.0 Architecture Overview
| effect | IP Address | Installation services |
|---|---|---|
| Main load balancer | 192.168.13.10 | ipvsadm/keepalived |
| Node server 1 | 192.168.13.20 | httpd |
| Node server 2 | 192.168.13.30 | httpd |
| Backup load balancer | 192.168.13.40 | ipvsadm/keepalived |
1.2 Node server
yum install -y httpd
cd /etc/sysconfig/network-scripts/
cp ifcfg-lo ifcfg-lo:0
vim ifcfg-lo:0
DEVICE=lo:0
IPADDR=192.168.13.100
NETMASK=255.255.255.255
ONBOOT=yes
vim /etc/rc.local
route add -host 192.168.13.100 dev lo:0
chmod +x /etc/rc.d/rc.local
vim /etc/sysctl.conf
net.ipv4.conf.lo.arp_ignore = 1
net.ipv4.conf.lo.arp_announce = 2
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.all.arp_announce = 2
sysctl -p
echo '<h1>This is the first test web1!</h1>' > /var/www/html/index.html
systemctl start httpd
# Repeat for another node server
1.2 Main load balancing server
yum install -y ipvsadm keepalived
cd /etc/keepalived
vim keepalived.conf
10 That's ok :smtp_server 127.0.0.1
12 That's ok :router_id LVS_01
13-16 That's ok : Delete
#vrrp Hot backup module #
17 That's ok :interface ens33
19 That's ok (priority 100 Insert... Above ):nopreempt
27 That's ok :192.168.13.100
28-29 That's ok : Delete
#virtual Virtual server module #
31 That's ok :192.168.13.100 80
34 That's ok :lb_kind DR
35 That's ok :persistence_timeout 0
36 That's ok :protocol TCP
38 That's ok :real_server 192.168.13.20 80 {
39 That's ok :weight 1
40 That's ok :TCP_CHECK {
41 That's ok :connect_port 80
42 That's ok :connect_timeout 3
43 That's ok :nb_get_retry 3
44 That's ok :delay_before_retry 3
45 That's ok :}
46 That's ok :}
47-55 That's ok :38,46 co 46
# The above 9 Copy the row node server configuration , Change the node server IP address
56 That's ok :}
56 Below row : Delete all
systemctl start keepalived
scp keepalived.conf 192.168.13.40:`pwd`
ipvsadm-save > /etc/sysconfig/ipvsadm
systemctl restart keepalived
ipvsadm -ln
1.3 Standby load balancing server
yum install -y ipvsadm keepalived
cd /etc/keepalived/
vim keepalived.conf
12 That's ok :router_id LVS_02
16 That's ok :state BACKUP
20 That's ok :priority 90
systemctl start keepalived
ipvsadm-save > /etc/sysconfig/ipvsadm
systemctl start ipvsadm
systemctl restart keepalived
ipvsadm -ln
1.4 test
- 1、 Web access 192.168.13.100, Generate load balancing effect
- 2、 Main load :systemctl stop keepalived,VIP Address jumps to standby load balancer (ip addr see )
Two 、 Load balancer profile template
! Configuration File for keepalived
global_defs {
notification_email {
[email protected].loc
[email protected].loc
[email protected].loc
}
notification_email_from Alexandre.[email protected].loc
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id LVS_01
}
vrrp_instance VI_1 {
state MASTER
interface ens33
virtual_router_id 51
nopreempt
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.13.100
}
}
virtual_server 192.168.13.100 80 {
delay_loop 6
lb_algo rr
lb_kind DR
persistence_timeout 0
protocol TCP
real_server 192.168.13.20 80 {
weight 1
TCP_CHECK{
connect_port 80
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
real_server 192.168.13.30 80 {
weight 1
TCP_CHECK{
connect_port 80
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
3、 ... and 、 Conclusion
- Good mentality
边栏推荐
- Post-processing of ffmpeg miscellaneous notes
- C language to achieve minesweeping games
- JVM tuning
- C language judging big end and small end [consortium or pointer] big end and small end conversion
- RTMP protocol
- 学 SQL 必须了解的10个高级概念
- C memory alignment
- Uoj 554 [unr 4] challenges Hamilton [find Hamilton path (adjustment method)]
- Sdl-3 YUV playback
- Qstring to hexadecimal qstring
猜你喜欢

Post-processing of ffmpeg miscellaneous notes

【Oracle 数据库】奶妈式教程day02 数据库管理工具SQLPLUS的使用

2022 low voltage electrician test questions and online simulation test
![[analysis of STL source code] summary notes (3): vector introduction](/img/70/faa40c273f6b3a6b124fb870058489.jpg)
[analysis of STL source code] summary notes (3): vector introduction

2022低压电工考题及在线模拟考试

RTMP protocol

Multi thread review summary parsing volatile keyword

Miscellany C language

Use of wordcloud

JVM学习记录(七)——类加载过程与双亲委派模型
随机推荐
[STL source code analysis] summary notes (10): hashtable exploration
Smart pointer (simple version)
软件测试周刊(第75期):唯有平视,才能看见真实的自己。
RTMP protocol
nosqlzoo刷题-1
big. Js-- use / instance
May 30-June 5, 2022 AI industry weekly (issue 100): three years
Nim product
MFC debugger OutputDebugString override
【Oracle 数据库】奶妈式教程day03 排序查询
Multi thread review summary parsing volatile keyword
2020080 simulation competition [horizontal and vertical coordinates do not affect each other, cactus minimum cut, combined meaning translation formula]
多线程复习总结之解析Volatile关键字
【AtCoder2376】Black and White Tree(博弈)
Decimal to binary
20200810 T2 dispatch money
Seata的几种事务模式
【Oracle 数据库】奶妈式教程day04 排序查询
Qstring to hexadecimal qstring
QT interface nested movement based on qscrollarea