没有合适的资源?快使用搜索试试~ 我知道了~
MySQL关于异步复制、同步复制半同步复制、无损复制的概念与区别
4星 · 超过85%的资源 需积分: 50 93 下载量 135 浏览量
2017-03-10
12:28:23
上传
评论
收藏 179KB PDF 举报
温馨提示
试读
5页
MySQL关于“异步复制”“同步复制”“半同步复制”“无损复制”的概念与区别,这技术面试经常问到的
资源推荐
资源详情
资源评论
mysql关于“异步复制”“同步复制”“半同步复制”“无损复制”的概念与区别
大概意思是说:
异步复制:主把事务写到binlog日志并不管从是否接收或者什么时候接收,commit之后,不会与
从发生ack之类的交互。
同步复制:当主提交一个事务,在主向前端返回一个commit成功的指令前,必须保证所有的从
已经提交了这个事务(所有从不但接收了,还必须apply了该事务日志)
半同步复制(5.7.2版本之前默认且唯一的一个参数值after_commit):主上客户端发出提交指令,
事务提交到了存储引擎后,等待从传递过来ack,再向前端返回成功的状态。与无损复制的区别
就是:如果在主上这个事务已经提交到了存储引擎,而正在等待从的ack过程中---这个时候发生
creash,则主上这个事务其实已经认为commit了,而从还没commit,在切换到从后,就会回滚
最后的这个事务,这个时候主从的时候其实就不一致了)
无损复制(5.7.2版本之后一个参数值after_sync):主上客户端发出提交指令,事务写入到了binlog,
传递到了从(事务写入到了relay.log且flush to disk中持久化到了磁盘的relay.log中 )然 后从给主
反馈一个ack,master才会把事务提交到存储引擎且返回到client一个commit成功的指令。
以下是官方文档解析:
In addition to the built-in asynchronous replication, MySQL 5.7 supports an interface to
semisynchronous replication that is implemented by plugins. This section discusses what
semisynchronous replication is and how it works. The following sections cover the
administrative interface to semisynchronous replication and how to install, configure, and
monitor it.
(异步复制)
MySQL replication by default is asynchronous. The master writes events to its binary log but
does not know whether or when a slave has retrieved and processed them. With
asynchronous replication, if the master crashes, transactions that it has committed might not
have been transmitted to any slave.
Consequently, failover from master to slave in this case may result in failover to a server that is
missing transactions relative to the master.
Semisynchronous replication can be used as an alternative to asynchronous replication:
• A slave indicates whether it is semisynchronous-capable when it connects to the master.
• If semisynchronous replication is enabled on the master side and there is at least one
semisynchronous slave, a thread that performs a transaction commit on the master blocks and
waits until at least one semisynchronous slave acknowledges that it has received all events for
the transaction, or until a timeout occurs.
• The slave acknowledges receipt of a transaction's events only after the events have been
written to its relay log and flushed to disk.
If a timeout occurs without any slave having acknowledged the transaction, the master reverts
资源评论
- wangjh4222017-12-28东西很好,把这几个概念分析清楚了。
- ssofnyga2017-12-04不错不错,这需要学习学习。。。
- kimmy2572018-05-16只能算勉强解释清了,还以为有什么独到之处呢......老实说不值10分...
- 末路狂奔2018-03-29不错 不错
machen_smiling
- 粉丝: 506
- 资源: 1958
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功