当前位置:网站首页>MySQL主从同步之 异步复制 半同步复制 全同步复制
MySQL主从同步之 异步复制 半同步复制 全同步复制
2022-06-29 11:32:00 【一只小小狗】
为了解决主从同步不一致的问题
1、异步复制
主库执行完提交事务后,立刻异步执行将结果返给给客户端,并不关心从库是否收到并处理。如果出现从库并未收到处理的情况,还是会有主从数据不一致的问题。期MySQL(5.5以前)仅仅支持异步复制。并且早期支持 myisam引擎。
2、半同步复制
主库在执行完客户端提交的事务后不是立刻返回给客户端,而是等待至少一个从库接收到并写到 relay log 中才返回给客户端。相对于异步复制,半同步复制提高了数据的安全性,同时它也造成了一定程度的延迟。
半同步复制的出现,就是为了保证在任何时刻主备数据一致的问题。相对于异步复制,半同步复制要求执行的每一个事务,都要求至少有一个备库成功接收后,才返回给用户。实现原理也很简单,主库本地执行完毕后,等待备库的响应消息(包含最新备库接收到的binlog(file,pos)),接收到备库响应消息后,再返回给用户,这样一个事务才算真正完成。在主库实例上,有一个专门的线程(ack_receiver)接收备库的响应消息,并以通知机制告知主库备库已经接收的日志,可以继续执行。
3、全同步复制
当主库提交事务之后,所有的从库节点必须收到、APPLY并且提交这些事务,然后主库线程才能继续做后续操作。因为需要等待所有从库执行完该事务才能返回,所以全同步复制的性能必然会收到严重的影响。
如有错误欢迎指正
边栏推荐
- When a technician becomes a CEO, what "bugs" should be modified?
- shell判断命令是否执行成功
- [VTK] MFC grid editor based on vtk8.2
- GBase8s数据库INTO EXTERNAL 子句
- 速看|期待已久的2022年广州助理检测工程师真题解析终于出炉
- Easy express: we use Zadig to realize 10000 times of construction and deployment, smart operation and maintenance, and release development productivity
- The blackened honeysnow ice city wants to grasp the hearts of consumers by marketing?
- [graduation season] summarize the past and look forward to the future
- 杰理之发起对耳配对、回连、开启可发现、可连接的轮循函数【篇】
- Intelligent trash can (IV) -- raspberry pie Pico realizes ultrasonic ranging (hc-sr04)
猜你喜欢

年轻就要醒着拼,年轻就要勇于尝试

Oracle netsuite helps TCM bio understand data changes and make business development more flexible

Numpy的ndarray数组基础

When you are young, you should be awake to fight, and when you are young, you should have the courage to try
![Jerry's about TWS pairing mode configuration [chapter]](/img/c8/d78e817295169753244299545d9aba.png)
Jerry's about TWS pairing mode configuration [chapter]

Unified exception reporting practice based on bytecode

Embedded database development programming (IV) -- DDL, DML

杰理之关于 TWS 声道配置【篇】

Ttchat x Zadig open source co creates helm access scenarios, and environmental governance can be done!

自动化测试摸索之路---准备工作
随机推荐
Installation and configuration of MariaDB
shell判断命令是否执行成功
杰理之关于开机发起回连对耳的位置:【篇】
启泰观察:职业精英创业必踩巨坑之 --- 学习效果坑
易快报:我们用 Zadig 实现万次构建部署,聪明运维,释放开发生产力
Pro test! Centos7 deploy PHP + spool
MATLAB Gui 实现点击按钮,打开文件对话框,导入图片功能
Codeforces Round #803 (Div. 2)
Initial use of eolink
初次使用 eolink 感受
GBase8s数据库select有ORDER BY 子句1
Engineering practice behind dall-e 2: ensure that the output of the model complies with the content policy
文件包含之日志中毒(User-Agent)
win11网页版
爱可可AI前沿推介(6.29)
Take another picture of cloud redis' improvement path
一种可解释的几何深度学习模型,用于基于结构的蛋白质结合位点预测
Students' programming stories
GBase8s数据库select有ORDER BY 子句6
When you are young, you should be awake to fight, and when you are young, you should have the courage to try