How to make MySQL work with Raft
Diancheng Wang & Guangchao Bai Staff Database Engineer @ Alibaba Cloud
How to make MySQL work with Raft Diancheng Wang & Guangchao Bai - - PowerPoint PPT Presentation
How to make MySQL work with Raft Diancheng Wang & Guangchao Bai Staff Database Engineer @ Alibaba Cloud About me Name: Guangchao Bai Location: Beijing, China Occupation: Staff Database Engineer @ Alibaba Cloud Focus on
How to make MySQL work with Raft
Diancheng Wang & Guangchao Bai Staff Database Engineer @ Alibaba Cloud
2
About me
3
Agenda
4
Background
6
For your data safety, For your application stability
2003 2011 2014 2017
* Internal business
* RDS for MySQL 5.1 * RDS for MySQL 5.6 * RDS for MySQL 5.7 * RDS Advanced Edition for MySQL 5.6
https://github.com/alibaba/alisql
7
Hard ware cost Mana geme nt Cost Hum an Cost
rtunit y Cost Hard ware Cost Mana geme nt Cost Hum an Cost Oppo rtunit y Cost
Self-built database Use RDS
Save cost 30%
Support OpenAPI Reduce work by 70% Buy on demand Run right now Nothing Focus on business Machine IDC Low utilization DBAs Monitor Backup Middleware Hinder innovation
MySQL for Cloud——Cost Analysis
8
MySQL Instance Storage
Basic DB
MySQL 5.7
➢ Cost-effective
Master Slave
High-available DB
MySQL 5.5/5.6/5.7
➢ Continuity
Master
Advanced Edition
MySQL 5.6
➢ Greatest stability
Slave Slave Raft
RDS for MySQL —— Enterprise Safety
9
New scenarios are emerging, and new requirements are also raised. We must ensure that data cannot be lost or confused any time. So we developed such a new MySQL database product , RDS Advanced Edition for MySQL based on RAFT.
Features & Scenarios for RDS
Architecture of RDS Advanced Edition for MySQL
11
MySQL Raft Architecture
Master Slave-2 Slave-1 RAFT
channel channel
12
MySQL Raft Architecture
Master Slave-2 Slave-1 RAFT
channel channel
13
Master
MySQL Raft Architecture
Master Slave-2 RAFT
channel channel channel
14
Master
MySQL Raft Architecture
Slave-2 RAFT
channel channel
Slave-1
15
MySQL Raft Architecture
Failover module RAFT module Transaction module Binlog module
Follower Follower
REPL channel RAFT channel REPL channel RAFT channel
Leader Follower Follower
16
About me
18
RAFT basic
19
RAFT states
20
RAFT term
21
Log replication
22
Log entry organization
Colors identify terms
23
Election restriction
committed entries
log
least as up to date as their own log.
25
Overview of MySQL-Raft implementation
variable settings:
26
Extra election restriction in MySQL-Raft(I)
with old leader
27
Extra election restriction in MySQL-Raft(II)
28
Processing unsynced transactions(I)
unsynced transactions
29
Processing unsynced transactions(II)
following steps:
30
What’s Flashback
31
Binlog and Raft log (I)
32
Binlog and Raft log (II)
33
Leadership transfer
complete after about an election timeout
34
35