当前位置:网站首页>云原生微服务第三章之Haproxy+Keepalived
云原生微服务第三章之Haproxy+Keepalived
2022-07-27 19:18:00 【51CTO】
1、高可用服务搭建
1.1 Keepalived介绍
Keepalived软件起初是专为LVS负载均衡设计的,用来管理并监控LVS集群各系统中各个服务节点的状态,后来又加入了可以实现高可用的VRRP功能,因此,Keepalived除了能够管理LVS软件外,还可以作为其他服务(例如:Nginx、Haproxy、MySQL等)的高可用解决方案
1.2 Keepalived组成原理
Keepalived软件主要是通壶VRRP协义实现高可用功能的。
VRRP是虚拟路由协义的缩写,VRRP出现的目的是为了解决静态路由单点故障问题的,它能够保证个别节点宕机时,整个网络不间断地运行。
虚拟路由冗余协义,可以认为是路由器高可用的协议,即将N台提供相同功能的路由器组成一个路由器组,这个组里面有一个master和backup,master上面有一个对外提供服务的vip(该路由器所在局域网内其他机器的默认路由为该VIP),master会发组播,当backup收不到vrrp包时就认为master宕掉了,这里就需要根据vrrp的优先级来选举一个backup当master。这样的话就可以保证路由器的高可用了。
1.3 环境说明
角色 | 服务器IP |
keepalived-master | 10.0.7.16 |
keepalived-backup | 10.0.7.17 |
1.4 目录和文件介绍
文件或者目录 | 作用 |
/etc/keepalived/keepalived.conf | 生效的配置文件 |
/etc/init.d/keepalived | 服务器管理脚本 |
/var/log/messages | 日志信息 |
1.4 部署keepalived
两台服务器同时执行
1.5 配置主keepalived
默认部署完没有配置文件可以通过find / -name keepalive*,然后拷贝其中一个到配置文件目录,如下
cp /usr/share/doc/keepalived/samples/keepalived.conf.vrrp.scripts /etc/keepalived/keepalived.conf
这里我已经准备好配置文件
10.0.7.16执行
1.6 配置从keepalived
10.0.7.17执行,修改工作模式为BACKUP,优先级调为50
1.7 重启
两台服务器同时执行
边栏推荐
- The design idea of relational database is obvious to you in 20 pictures
- Small change project (two versions) with detailed ideas
- Implementation of arbitrary code execution based on.Net dynamic compilation technology
- Can JVM tuning be done with single core CPU and 1G memory?
- Open source data quality solution -- Apache Griffin primer
- How can anyone ask how MySQL archives data?
- Import word document pictures blocking and non blocking IO operations
- Talk about MySQL transaction two-phase commit
- Enumeration and annotation
- Software testing interview question: how many strategies are there for system testing?
猜你喜欢

Can JVM tuning be done with single core CPU and 1G memory?

B站崩了,那晚负责修复的开发人员做了什么?

Read Plato farm's eplato and the reason for its high premium

JVM memory model interview summary

学完4种 Redis 集群方案要多久?我一口气给你说完

Log4j vulnerability is still widespread and continues to cause impact

LVS+Keepalived高可用群集
Excalidraw: an easy-to-use online, free "hand drawn" virtual whiteboard tool
![[question 24] logic closed loop (Beijing Institute of Technology / Beijing University of Technology / programming methods and practice / primary school)](/img/c4/71a9933a3a1fdd14f84a41b640f5b5.jpg)
[question 24] logic closed loop (Beijing Institute of Technology / Beijing University of Technology / programming methods and practice / primary school)

How to customize logging of.Net6.0
随机推荐
单核CPU, 1G内存,也能做JVM调优吗?
What is eplato cast by Plato farm on elephant swap? Why is there a high premium?
8000字讲透OBSA原理与应用实践
项目分析(从技术到项目、产品)
MySQL执行过程及执行顺序
关系型数据库的设计思想,20张图给你看的明明白白
Openai issued a document to introduce the latest application of Dall · E 2: fully enter the field of artistic creation and design
内部类(四种内部类详解)
美司法部增加针对华为的指控,包括窃取商业秘密等16项新罪名
Internal class (detailed explanation of four internal classes)
Mask automatic update description file (mask description file)
In addition to "adding machines", in fact, your micro service can be optimized like this
软件测试面试题:什么是回归测试?
深入理解递归的方法调用(含实例迷宫问题、汉诺塔、猴子吃桃、斐波拉契、阶乘))
项目分析(哪些是it培训给不了)
软件测试面试题:单元测试、集成测试、系统测试的侧重点是什么?
Software testing interview question: what is the focus of unit testing, integration testing, and system testing?
It seems to be a bug of thread pool, but I think the source code design is unreasonable.
Shengyang technology officially launched the remote voiceprint health return visit service system!
软件测试面试题:软件测试项目从什么时候开始?为什么?