当前位置:网站首页>Mysql 45 study notes (twenty-five) MYSQL guarantees high availability
Mysql 45 study notes (twenty-five) MYSQL guarantees high availability
2022-07-31 03:18:00 【Kong Tom】
One. Eventual consistency
- As long as main library performs an updateall binlogs generated will be sent to standby and executed correctly
- The standby database can reach the same state as the main database
2. Primary and secondary delay
1. Synchronization delay
- Main library A executes a transaction and writes it to binlog. At this time, we record this moment as T1;
- Pass it to the standby database B, we record the moment when the standby database B receives the binlog as T2;
- Standby B executes this transaction, and we record this moment as T3
Main-standby delay: The difference between the time when the same transaction is completed in the standby database and the time when the main database is completed----T3-T1
2.show salve status command
The standby database executes the show slave status command, and the returned result shows seconds_behind_master, indicating how many seconds the current standby database is delayed
3.seconds_behind_master calculation method
- The binlog of each transaction contains a aTime field for records the time of writing on the master library;
- Standby libraryRemove the current executing transactionThe value of the time field, calculates its difference from the current system time
Three. The source of the main and standby delays
The machine performance of the standby database is worse than that of the main database, which may lead to the delay of the active and standby databases
Statistical analysis and query on the standby database consumes a lot of CPU resources
- One master and multiple slaves: multiple connections and slave libraries share the pressure of reading
- binlog is output to external systems, such as Hadoop systems, so that external systems can provide statistical query capabilities
3. Big business
Four. Reliability priority strategy

- Determine the current second_behind_master of standby database B, if it is less than 5s, continue, otherwise try again
- Change the main library A to read-only state and set readonly to true
- Determine the value of second_behind_master of standby database B until the value becomes 0 (Maintain reliability---need to be small enough, because it is unavailable at this time strong>)
- Change the standby database B to readable and writable state, that is, set readonly to false;
- Switch the business request to the standby database B
V. Availability priority strategy
- Change the standby database B to readable and writable state in step 4, that is, set readonly to false;
- Step 5 Switch the business request to the standby database B
- Directly execute unequal data synchronization and consistency
Disadvantages:
Inconsistent data
On the premise of data reliability, the availability of the MYAQL high-availability system depends on the delay of the active and standby systems
The smaller the delay time, the shorter the recovery time of the faulty service in the main database, the higher the availability
边栏推荐
- 4. Sensitive word filtering (prefix tree)
- 加密公司向盗窃的黑客提供报价:保留一点,把剩下的归还
- web容器及IIS --- 中间件渗透方法1
- Local area network computer hardware information collection tool
- Graphical lower_bound & upper_bound
- Getting Started with CefSharp - winform
- 品牌广告投放平台的中台化应用与实践
- 数据库文件中的未分配的块和未使用的块的区别
- Distributed locks and three implementation methods
- 冒泡排序、选择排序、直接插入排序、二分法查找
猜你喜欢

Compile Hudi

Several common errors when using MP

TCP详解(二)

6. Display comments and replies
![[Compilation principle] Lexical analysis program design principle and implementation](/img/eb/035234a402edf18beb7e2f82ebec17.png)
[Compilation principle] Lexical analysis program design principle and implementation

LeetCode简单题之找到和最大的长度为 K 的子序列
![[C language] Preprocessing operation](/img/69/0aef065ae4061edaf0d96b89846bf2.png)
[C language] Preprocessing operation

Use of QML

10 Permission introduction

Graphical lower_bound & upper_bound
随机推荐
Mycat's master-slave relationship, vertical sub-database, horizontal sub-table, and detailed configuration of mycat fragmented table query (mysql5.7 series)
Annotation usage meaning
原子操作 CAS
解析小结—自用
Mysql 45讲学习笔记(二十四)MYSQL主从一致
Golang中的addressable
Detailed explanation of TCP and UDP
LeetCode simple problem to find the subsequence of length K with the largest sum
Ambiguous method call.both
STM32 problem collection
11. Redis implements follow, unfollow, and follow and follower lists
TCP/IP four-layer model
【Cocos Creator 3.5】缓动系统停止所有动画
大小端模式
SonarQube的BUG定义
【CocosCreator 3.5】CocosCreator 获取网络状态
选好冒烟测试用例,为进入QA的制品包把好第一道关
SIP Protocol Standard and Implementation Mechanism
刚出道“一战成名”,安全、舒适一个不落
【编译原理】词法分析程序设计原理与实现