Professional Documents
Culture Documents
Mysql PN Replication Gtid Failover
Mysql PN Replication Gtid Failover
6 Replication:
Self-Healing Clusters with GTIDs
`2
PART 1
Fail-over Base
Global Transaction Identifiers
Overview
Automatic Positioning
Hands-On
PART 2
Under the Hood Become a GTID Expert
How Slave Preserves GTIDs
GTIDs Must Be Unique
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Fail-over
`4
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Fail-over
B
A
C
`5
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Fail-over
B
A
Crash
C
`6
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Fail-over
B
A
C
`7
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Fail-over
A
C
`8
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Fail-over
`9
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Fail-over
`10
B
Crash
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Fail-over
`11
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Fail-over
Example 2: line
`12
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Fail-over
Example 3: circle
`13
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Fail-over
D
Crash
Example 3: circle
`14
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Fail-over
Example 3: circle
`15
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Fail-over
Example 3: circle
Make a shortcut
in the circle
`16
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Fail-over
Example 3: circle
Example 4: scheduled maintenance
`17
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Fail-over
Take
out D!
Example 1: tree
Example 2: line
Example 3: circle
Example 4: scheduled maintenance
`18
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Fail-over
Maintain
D offline,
without
disrupting
service
Example 3: circle
Example 4: scheduled maintenance
`19
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Fail-over
Example 3: circle
Example 4: scheduled maintenance
`20
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Fail-over
Example 3: circle
Example 4: scheduled maintenance
Example 5: arbitrary topology
`21
D
C
E
F
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Wow!
I really want to get started
with fail-over. Tell me more!
`22
Overview
Fail-over Base
Global Transaction Identifiers
Automatic Positioning
Hands-On
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
transaction:
server_uuid:number
a61678ba-4889-4279-9e58-45ba840af334:1
server_uuid identifies the server; globally unique
number is incremented by 1 for each transaction on this server
`24
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
transaction:
server_uuid:number
a61678ba-4889-4279-9e58-45ba840af334:1
server_uuid identifies the server; globally unique
number is incremented by 1 for each transaction on this server
`25
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
transaction:
server_uuid:number
a61678ba-4889-4279-9e58-45ba840af334:1
server_uuid identifies the server; globally unique
number is incremented by 1 for each transaction on this server
`26
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
New variable:
gtid_executed
`27
Note: interval
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
`28
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Slave is missing
one transaction
`29
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
`30
Overview
Fail-over Base
Global Transaction Identifiers
Automatic Positioning
Hands-On
`32
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Automatic Positioning
Example 1: tree
B
A
id1,trx1,
id2,trx2,
id3,trx3
(crashed)
(master)
id1,trx1,
id2,trx2
(slave)
id1,trx1
C
(slave)
`33
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Automatic Positioning
Example 1: tree
B
id1,trx1,
id2,trx2,
ACrash!
id3,trx3
(crashed)
(master)
id1,trx1,
id2,trx2
(slave)
id1,trx1
C
(slave)
`34
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Automatic Positioning
Example 1: tree
What the
slave has
B
A
id1,trx1,
id2,trx2,
id3,trx3
(crashed)
(crashed)
`35
id1,trx1,
id2,trx2
id1
(slave)
id2, trx2,...
What the
slave does
not have
id1,trx1
C
(slave)
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Automatic Positioning
Example 1: tree
Example 2: circle
`36
client
client
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Automatic Positioning
Example 1: tree
Example 2: circle
client
client trx1
id1,trx1
`37
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Automatic Positioning
Example 1: tree
Example 2: circle
client trx2
client trx1
id2,trx2
`38
id1,trx1,
id2,trx2
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Automatic Positioning
Example 1: tree
Example 2: circle
client trx2
id2,trx2
`39
id1,trx1,
id2,trx2,
id3,trx3
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Automatic Positioning
Example 1: tree
Example 2: circle
client trx2
id2,trx2
`40
id1,trx1,
id2,trx2,
id3,trx3
C Crash!
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Automatic Positioning
Example 1: tree
Example 2: circle
client trx2
id2,trx2
What the
slave has
`41
B
id2
id1,trx1,id3,trx3,...
id1,trx1,
id2,trx2,
id3,trx3
What the
slave does
not have
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Awesome!
I'm really eager to get started.
How do I set it up?
`42
Overview
Fail-over Base
Global Transaction Identifiers
Automatic Positioning
Hands-On
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Hands-On
Prerequisites:
Use transactional storage engine for all tables (InnoDB)
Don't use CREATE TABLE SELECT
Don't execute CREATE TEMPORARY TABLE or
`44
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Hands-On
`45
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Hands-On
Perform fail-over
`46
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Hands-On
Perform fail-over
B
A
C
`47
CHANGE MASTER TO
MASTER_HOST = 'B',
MASTER_PORT = <B's port>,
MASTER_USER = '<user name>'
MASTER_PASSWORD = 'secret';
Introduction to MySQL Replication ! Fail-over Base ! Under the Hood ! Integration With Other Features
Hands-On
Perform fail-over
`48
CHANGE MASTER TO
MASTER_HOST = 'A',
MASTER_PORT = <A's port>,
MASTER_USER = '<user name>'
MASTER_PASSWORD = 'secret';
More on GTIDs
Next
Steps
svenmysql.blogspot.co.uk
mysql-5.6-replication.html
`49