SlideShare a Scribd company logo
1 of 87
Download to read offline
Frédéric Descamps
Community Manager
MySQL
February 2022
FOSDEM 2022 MySQL
Devroom
MySQL 8.0: Logical Backups,
Snapshots and PITR like a
rockstar
Copyright @ 2022 Oracle and/or its affiliates.
Who am I ?
about.me/lefred
2
Frédéric Descamps
Copyright @ 2022 Oracle and/or its affiliates.
@lefred
MySQL Evangelist
hacking MySQL since 3.21
devops believer
living in
h ps://lefred.be
3
Copyright @ 2022 Oracle and/or its affiliates.
2022 best practices
se ings
4
I assume that your system
is running MySQL 8.0.27 or later
uses only InnoDB
has binary logs enabled (required for PITR)
binary logs must use ROW format
uses GTID
Copyright @ 2022 Oracle and/or its affiliates.
5
Copyright @ 2022 Oracle and/or its affiliates.
Point-in-Time Recovery
using the binary logs
6
Point-in-Time Recovery
This is the technique whereby an administrator can restore or recover a set of data to a
certain point usually in the past.
In MySQL, point-in-time recovery consists in restoring a dump of the data and then replay
the binary logs from and to a speci c point.
This technique is used for:
xing a problem
live migration
Copyright @ 2022 Oracle and/or its affiliates.
7
Point-in-Time Recovery : how does it work ?
day 1
BACKUPS
Binlogs
day 2 day 3 day 4
.001
.002
.003 .004 .005 .006 .007 .008 .009 .010
Copyright @ 2022 Oracle and/or its affiliates.
8
Point-in-Time Recovery : how does it work ?
day 1
BACKUPS
Binlogs
day 2
we want to recover
at this point !
day 3 day 4
.001
.002
.003 .004 .005 .006 .007 .008 .009 .010
Copyright @ 2022 Oracle and/or its affiliates.
9
Point-in-Time Recovery : how does it work ?
day 1
BACKUPS
Binlogs
day 2
we want to recover
at this point !
day 3 day 4
.001
.002
.003 .004 .005 .006 .007 .008 .009 .010
1. we restore the dump (of day3)
Copyright @ 2022 Oracle and/or its affiliates.
10
Point-in-Time Recovery : how does it work ?
day 1
BACKUPS
Binlogs
day 2 day 3 day 4
.001
.002
.003 .004 .005 .006 .007 .008 .009 .010
1. we restore the dump (of day3)
2
.
w
e
r
e
p
l
a
y
t
h
e
binary
logs (.008)
Copyright @ 2022 Oracle and/or its affiliates.
11
Point-in-Time Recovery : important concept
Usually after a backup is made and veri ed, binary log les are purged from the MySQL
server:
Copyright @ 2022 Oracle and/or its affiliates.
12
Point-in-Time Recovery : important concept
Usually after a backup is made and veri ed, binary log les are purged from the MySQL
server:
Copyright @ 2022 Oracle and/or its affiliates.
day 1
BACKUPS
Binlogs
day 2 day 3 day 4
.001
.002
.003 .004 .005 .006 .007 .008 .009 .010
12
Point-in-Time Recovery : important concept
Usually after a backup is made and veri ed, binary log les are purged from the MySQL
server:
Copyright @ 2022 Oracle and/or its affiliates.
day 1
BACKUPS
Binlogs
day 2 day 3 day 4
.001
.002
.003 .004 .005 .006 .007 .008 .009 .010
day 1
BACKUPS
recoverable
points in time
Binlogs
day 2 day 3 day 4
.001
.002
.003 .004 .005 .006 .007 .008 .009 .010
}
12
Point-in-Time Recovery : important concept (2)
As you can see we can only recover to the exact time of the backups/dumps and do point-
in-time recovery only from the last one !
This is why it's recommended to also stream the binary logs somewhere else (another
server, a NAS, the cloud, ...).
This will allow to make a point-in-time recovery at any point back in time:
Copyright @ 2022 Oracle and/or its affiliates.
13
Point-in-Time Recovery : important concept (2)
As you can see we can only recover to the exact time of the backups/dumps and do point-
in-time recovery only from the last one !
This is why it's recommended to also stream the binary logs somewhere else (another
server, a NAS, the cloud, ...).
This will allow to make a point-in-time recovery at any point back in time:
Copyright @ 2022 Oracle and/or its affiliates.
}
day 1
BACKUPS
recoverable
points in time
Binlogs
day 2 day 3 day 4
.001
.002
.003 .004 .005
.001
.002
.003
.004
.005
.006 .007 .008 .009 .010
.006
.007
.008
.009
.010
b
i
n
l
o
g
s
t
r
e
a
m
i
n
g
13
Point-in-Time Recovery for Fixing Something
Why should we perform point-in-time recovery ?
Copyright @ 2022 Oracle and/or its affiliates.
14
Point-in-Time Recovery for Fixing Something
Why should we perform point-in-time recovery ?
a user made a mistake
we need to nd back data from a certain point-in-time
we need to have an overview of the database at a certain time
Copyright @ 2022 Oracle and/or its affiliates.
14
Point-in-Time Recovery for Live Migration
When we do large migration (to the cloud for example), the load time can take longer than
the binary log retention on the MySQL server that will be used as Replication Source.
Then, Point-in-time recovery technique will be used to sync the future replica to be elligible
for asynchronous replication.
Copyright @ 2022 Oracle and/or its affiliates.
15
Point-in-Time Recovery for Live Migration
day 1
BACKUPS/DUMPS
Binlogs
day 2 day 3 day 4
.001
.002
.003 .004
.001
.002
.003
.004
b
i
n
l
o
g
s
t
r
e
a
m
i
n
g
load started
Copyright @ 2022 Oracle and/or its affiliates.
16
Point-in-Time Recovery for Live Migration
day 1
BACKUPS/DUMPS
Binlogs
day 2 day 3 day 4
b
i
n
l
o
g
s
t
r
e
a
m
i
n
g
load finished
.001
.002
.003
.004
.005
.006
.007
.008
.009
.010
.001
.002
.003 .004 .005 .006 .007 .008 .009 .010
dataset: gtid in .003
Copyright @ 2022 Oracle and/or its affiliates.
17
Point-in-Time Recovery for Live Migration
day 1
BACKUPS/DUMPS
Binlogs
day 2 day 3 day 4
b
i
n
l
o
g
s
t
r
e
a
m
i
n
g
.001
.002
.003
.004
.005
.006
.007
.008
.009
.010
.001
.002
.003 .004 .005 .006 .007 .008 .009 .010
dataset: gtid in .003
r
e
p
l
a
y
f
r
o
m
.
0
0
3
to
.010
Copyright @ 2022 Oracle and/or its affiliates.
18
Point-in-Time Recovery for Live Migration
day 1
BACKUPS/DUMPS
Binlogs
day 2 day 3 day 4
b
i
n
l
o
g
s
t
r
e
a
m
i
n
g
.001
.002
.003
.004
.005
.006
.007
.008
.009
.010
.001
.002
.003 .004 .005 .006 .007 .008 .009 .010
dataset: gtid in .010
start replication
Copyright @ 2022 Oracle and/or its affiliates.
19
Copyright @ 2022 Oracle and/or its affiliates.
Backups
Physical, Logical, Snapshot, ...
20
Backups
For years, physical hot backups were recommended. With the increase in use of the cloud
for MySQL, logical backups are coming back to the forefront.
Copyright @ 2022 Oracle and/or its affiliates.
21
Backups
For years, physical hot backups were recommended. With the increase in use of the cloud
for MySQL, logical backups are coming back to the forefront.
First with mysqldump... but as you may know, this tool is not optimal. Single-threaded to
dump and single-threaded to load the data.
Copyright @ 2022 Oracle and/or its affiliates.
21
Backups
For years, physical hot backups were recommended. With the increase in use of the cloud
for MySQL, logical backups are coming back to the forefront.
First with mysqldump... but as you may know, this tool is not optimal. Single-threaded to
dump and single-threaded to load the data.
That's why, Oracle came up with MySQL Shell Dump & Load Utility !
Copyright @ 2022 Oracle and/or its affiliates.
21
MySQL Shell Dump & Load Utility
introduced with MySQL 8.0.21
supports export of all or selected schema
supports local storage (could be a mount to S3) and OCI Object Storage natively
supports dump from 5.6 (since 8.0.26), 5.7 and 8.0
can " x" your schema (force InnoDB, add an invisible primary key, ...)
dumps and loads in parallel
and more ...
Copyright @ 2022 Oracle and/or its affiliates.
22
The environment
To illustrate the scenarios in this presentation, I use the following system:
Copyright @ 2022 Oracle and/or its affiliates.
Ampere compute instance (VM.Standard.A1.Flex, 4 OCPU, 24GB RAM)
MySQL Server 8.0.27
MySQL Shell 8.0.27
sysbench 1.0.20 (generating load and data)
a specify table to play: fosdem.t1
23
Sysbench
Copyright @ 2022 Oracle and/or its affiliates.
24
Table t1
Copyright @ 2022 Oracle and/or its affiliates.
25
Logical Dump
As we plan to use our logical dump as a backup (or at least as an initial dump), we won't
focus on a speci c schema but dump the full instance using util.dumpInstance():
Copyright @ 2022 Oracle and/or its affiliates.
26
Logical Dump
As we plan to use our logical dump as a backup (or at least as an initial dump), we won't
focus on a speci c schema but dump the full instance using util.dumpInstance():
mysqlsh mysql://root@localhost -- util dump-instance backup-$(date +"%F")
Copyright @ 2022 Oracle and/or its affiliates.
26
Logical Dump (2)
Copyright @ 2022 Oracle and/or its affiliates.
27
The metadata of the
dump is a very
important le called
@.json and it's
located in the dump's
directory:
Logical Dump (3) - metadata
Copyright @ 2022 Oracle and/or its affiliates.
28
GTID - MySQL Shell Dump & Load Utility
We can see that our dump is consistent and that the last GTID part of it is:
"gtidExecuted": "b00098d0-72eb-11ec-b8d2-0200170c7057:1-129545",
Copyright @ 2022 Oracle and/or its affiliates.
29
GTID - MySQL Shell Dump & Load Utility
We can see that our dump is consistent and that the last GTID part of it is:
"gtidExecuted": "b00098d0-72eb-11ec-b8d2-0200170c7057:1-129545",
On the MySQL Server, we can see that sysbench is still running and keeps generating
data:
SQL > select @@gtid_executed;
+-----------------------------------------------+
| @@gtid_executed |
+-----------------------------------------------+
| b00098d0-72eb-11ec-b8d2-0200170c7057:1-296244 |
+-----------------------------------------------+
Copyright @ 2022 Oracle and/or its affiliates.
29
Copyright @ 2022 Oracle and/or its affiliates.
Snapshots
physical hot dumps
30
Physical Hot Snapshots
There are multiple ways of doing Snapshots:
Hot Backups (MEB, Xtrabackup): plenty of features, can be complicated to operate
Filesystem snapshots: not always hot depending on the technique and the lesystem
used.
MySQL CLONE
Copyright @ 2022 Oracle and/or its affiliates.
31
CLONE
Clone, introduced in MySQL 8.0.17, permits cloning data locally or from a remote MySQL
server instance. Cloned data is a physical snapshot of data stored in InnoDB that includes
schemas, tables, tablespaces, and data dictionary metadata. The cloned data comprises a
fully functional data directory, which permits using clone for MySQL server provisioning.
Copyright @ 2022 Oracle and/or its affiliates.
32
CLONE
Clone, introduced in MySQL 8.0.17, permits cloning data locally or from a remote MySQL
server instance. Cloned data is a physical snapshot of data stored in InnoDB that includes
schemas, tables, tablespaces, and data dictionary metadata. The cloned data comprises a
fully functional data directory, which permits using clone for MySQL server provisioning.
SQL > clone local data directory '/tmp/snapshot';
Query OK, 0 rows affected (5.6741 sec)
Copyright @ 2022 Oracle and/or its affiliates.
32
CLONE
Clone, introduced in MySQL 8.0.17, permits cloning data locally or from a remote MySQL
server instance. Cloned data is a physical snapshot of data stored in InnoDB that includes
schemas, tables, tablespaces, and data dictionary metadata. The cloned data comprises a
fully functional data directory, which permits using clone for MySQL server provisioning.
SQL > clone local data directory '/tmp/snapshot';
Query OK, 0 rows affected (5.6741 sec)
That's it ! As simple as that !
Copyright @ 2022 Oracle and/or its affiliates.
32
CLONE - GTID
The GTID of the snapshoted dataset can be found in performance_schema:
SQL > select GTID_EXECUTED from clone_status;
+-----------------------------------------------+
| GTID_EXECUTED |
+-----------------------------------------------+
| b00098d0-72eb-11ec-b8d2-0200170c7057:1-581783 |
+-----------------------------------------------+
Copyright @ 2022 Oracle and/or its affiliates.
33
Copyright @ 2022 Oracle and/or its affiliates.
Binary logs
all the data changes are stored
34
Binary Logs
The MySQL workload is wri en in the binary log les:
Copyright @ 2022 Oracle and/or its affiliates.
35
Binary Logs
The MySQL workload is wri en in the binary log les:
Copyright @ 2022 Oracle and/or its affiliates.
SQL > show binary logs;
+---------------+-----------+-----------+
| Log_name | File_size | Encrypted |
+---------------+-----------+-----------+
| binlog.000001 | 582 | No |
| binlog.000002 | 200 | No |
| binlog.000003 | 200 | No |
| binlog.000004 | 782809684 | No |
+---------------+-----------+-----------+
4 rows in set (0.0059 sec)
[root@my-compute ~]# ls -lh /var/lib/mysql/binlog.*
-rw-r-----. 1 mysql mysql 582 Jan 11 14:36 /var/lib/mysql/binlog.000001
-rw-r-----. 1 mysql mysql 200 Jan 11 14:36 /var/lib/mysql/binlog.000002
-rw-r-----. 1 mysql mysql 200 Jan 11 14:36 /var/lib/mysql/binlog.000003
-rw-r-----. 1 mysql mysql 758M Jan 11 16:08 /var/lib/mysql/binlog.000004
-rw-r-----. 1 mysql mysql 64 Jan 11 14:36 /var/lib/mysql/binlog.index
# let's divide the max size by 10 to have more logs to test
SQL > set persist max_binlog_size=107374182;
35
.001
.002
.003
.004
.005
.006
.007
.008
.009
.010
b
i
n
l
o
g
s
t
r
e
a
m
i
n
g
mysqlbinlog has the possibility of reading the binary logs from
a live server and store them to disk using the options --raw --
read-from-remote-server.
we create a script to use mysqlbinlog :
binlog_to_local.sh
we use systemd to start and stop our script
sources: h ps://tinyurl.com/binlogstream
Keeping binlogs safe
Copyright @ 2022 Oracle and/or its affiliates.
36
Keeping binlogs safe (2)
We rst need to create a dedicated user for our streaming process:
SQL> CREATE USER 'binlog_streamer' IDENTIFIED BY 'C0mpl1c4t3d!Passw0rd' REQUIRE SSL;
SQL> GRANT REPLICATION SLAVE ON *.* TO 'binlog_streamer';
SQL> GRANT SELECT ON performance_schema. le_instances TO 'binlog_streamer';
Copyright @ 2022 Oracle and/or its affiliates.
37
Keeping binlogs safe (2)
We rst need to create a dedicated user for our streaming process:
SQL> CREATE USER 'binlog_streamer' IDENTIFIED BY 'C0mpl1c4t3d!Passw0rd' REQUIRE SSL;
SQL> GRANT REPLICATION SLAVE ON *.* TO 'binlog_streamer';
SQL> GRANT SELECT ON performance_schema. le_instances TO 'binlog_streamer';
And to avoid to store credentials in our script, let's use MySQL Con g Editor :
$ mysql_con g_editor set --login-path=localhost --host=127.0.0.1 
--user=binlog_streamer --password
Enter password:
Copyright @ 2022 Oracle and/or its affiliates.
37
Keeping binlogs safe (3)
We can start the streaming using systemd:
Copyright @ 2022 Oracle and/or its affiliates.
38
Keeping binlogs safe (4)
The les are now also saved somewhere else (this can be another server of course):
Copyright @ 2022 Oracle and/or its affiliates.
39
Copyright @ 2022 Oracle and/or its affiliates.
Point-in-Time Recovery
examples
40
Something we would like to avoid...
Copyright @ 2022 Oracle and/or its affiliates.
41
Something we would like to avoid...
Copyright @ 2022 Oracle and/or its affiliates.
41
Restore last dump
Start Replication
Configure replication Replay binlogs(*)
find the GTIDs of the
transactions we want
to bypass
set GTID_PURGED to
dump's GTID_EXECUTED
append the GTIDs
to GTID_PURGED
Do
we use
another
instance?
Yes No
The Action Plan
Copyright @ 2022 Oracle and/or its affiliates.
42
Restore last dump
Start Replication
Configure replication Replay binlogs(*)
find the GTIDs of the
transactions we want
to bypass
set GTID_PURGED to
dump's GTID_EXECUTED
append the GTIDs
to GTID_PURGED
Do
we use
another
instance?
Yes No
The Action Plan
I chose to perform point-in-time recovery on
the same machine to show how we can
accelerate the process.
Copyright @ 2022 Oracle and/or its affiliates.
42
Before we start
Some actions are necessary before we start the point-in-time recovery process:
if you plan to do point-in-time recovery on the same instance, you need to stop the
application (sysbench in our case)
we check the last GTID_EXECUTED
we do select count(*) on the sysbench tables just to have an estimation we
recovered as expected.
stop the binlog streaming process
Copyright @ 2022 Oracle and/or its affiliates.
43
Before we start (2)
SQL > select @@GTID_EXECUTED;
+------------------------------------------------+
| @@GTID_EXECUTED |
+------------------------------------------------+
| b00098d0-72eb-11ec-b8d2-0200170c7057:1-5854318 |
+------------------------------------------------+
SQL > select (select count(*) from sbtest.sbtest1) t1,
... ,
(select count(*) from sbtest.sbtest8) t8;
+--------+--------+--------+--------+--------+--------+--------+--------+
| t1 | t2 | t3 | t4 | t5 | t6 | t7 | t8 |
+--------+--------+--------+--------+--------+--------+--------+--------+
| 667831 | 670327 | 669287 | 668361 | 668443 | 668736 | 670188 | 669557 |
+--------+--------+--------+--------+--------+--------+--------+--------+
$ sudo systemctl stop binlog_streaming@localhost.service
Copyright @ 2022 Oracle and/or its affiliates.
44
Restore Last Dump
We have again serveral options:
restore the logical dump made with MySQL Shell
restore the snapshot made with CLONE.
Copyright @ 2022 Oracle and/or its affiliates.
45
Restore Last Dump - MySQL Shell Utility
To restore a dump made with MySQL Shell Dump Utility, we need a MySQL server running.
We need to remove all non system schemas:
SQL > drop schema fosdem;
Query OK, 1 row affected (0.0225 sec)
SQL > drop schema sbtest;
Query OK, 8 rows affected (0.2117 sec)
Copyright @ 2022 Oracle and/or its affiliates.
46
Restore Last Dump - MySQL Shell Utility (2)
$ mysqlsh mysql://root@localhost -- util load-dump backup-2022-01-11 
--showMetadata --skipBinlog
Loading DDL and Data from 'backup-2022-01-11' using 4 threads.
Opening dump...
---
Dump_metadata:
Binlog_ le: binlog.000004
Binlog_position: 302256358
Executed_GTID_set: b00098d0-72eb-11ec-b8d2-0200170c7057:1-129545
Target is MySQL 8.0.27. Dump was produced from MySQL 8.0.27
Scanning metadata - done
...
chunks (400.00K rows, 76.71 MB) for 9 tables in 2 schemas
were loaded in 7 sec (avg throughput 11.33 MB/s)
0 warnings were reported during the load.
Copyright @ 2022 Oracle and/or its affiliates.
47
Restore Last Dump - MySQL Shell Utility (3)
We can already check if our table looks like what it was before the dump:
SQL > select * from t1;
+----+----------+---------------------+---------+
| id | name | inserted | updated |
+----+----------+---------------------+---------+
| 1 | dave | 2022-01-11 15:01:27 | NULL |
| 2 | miguel | 2022-01-11 15:01:27 | NULL |
| 3 | kenny | 2022-01-11 15:01:27 | NULL |
| 4 | joro | 2022-01-11 15:01:27 | NULL |
| 5 | johannes | 2022-01-11 15:01:27 | NULL |
+----+----------+---------------------+---------+
5 rows in set (0.0005 sec)
Copyright @ 2022 Oracle and/or its affiliates.
48
Restore Last Dump - MySQL Shell Utility (4)
We still need to set back the GTIDs:
SQL > select @@gtid_purged, @@gtid_executed;
+---------------+------------------------------------------------+
| @@gtid_purged | @@gtid_executed |
+---------------+------------------------------------------------+
| | b00098d0-72eb-11ec-b8d2-0200170c7057:1-5854320 |
+---------------+------------------------------------------------+
Copyright @ 2022 Oracle and/or its affiliates.
49
Restore Last Dump - MySQL Shell Utility (4)
We still need to set back the GTIDs:
SQL > select @@gtid_purged, @@gtid_executed;
+---------------+------------------------------------------------+
| @@gtid_purged | @@gtid_executed |
+---------------+------------------------------------------------+
| | b00098d0-72eb-11ec-b8d2-0200170c7057:1-5854320 |
+---------------+------------------------------------------------+
SQL > reset master;
SQL > set global gtid_purged='b00098d0-72eb-11ec-b8d2-0200170c7057:1-129545';
SQL > select @@gtid_purged, @@gtid_executed;
+---------------------------------+--------------------------------------+
| @@gtid_purged | @@gtid_executed |
+---------------------------------+--------------------------------------+
| b00098d0-72eb-11ec-...:1-129545 | b00098d0-72eb-11ec-b8d2-...:1-129545 |
+---------------------------------+--------------------------------------+
Copyright @ 2022 Oracle and/or its affiliates.
49
Restore Last Dump - CLONE
As the plan is to retore the snapshot on the same server, we need rst to save 2 imporant
les from MySQL's data directory:
auto.cnf: containing the server-uuid
mysqld-auto.cnf: containing all con guration changes done using SET PERSIST
additionnaly if you have your own dedicated keys in the datadir, you should also save
them
Copyright @ 2022 Oracle and/or its affiliates.
50
Restore Last Dump - CLONE (2)
Let's starti by saving the required les:
$ sudo cp /var/lib/mysql/auto.cnf snapshot
$ sudo cp /var/lib/mysql/mysqld-auto.cnf snapshot
Copyright @ 2022 Oracle and/or its affiliates.
51
Restore Last Dump - CLONE (2)
Let's starti by saving the required les:
$ sudo cp /var/lib/mysql/auto.cnf snapshot
$ sudo cp /var/lib/mysql/mysqld-auto.cnf snapshot
And now we stop MySQL and empty the datadir:
$ sudo systemctl stop mysqld
$ sudo rm -rf /var/lib/mysql/*
Copyright @ 2022 Oracle and/or its affiliates.
51
Restore Last Dump - CLONE (2)
Let's starti by saving the required les:
$ sudo cp /var/lib/mysql/auto.cnf snapshot
$ sudo cp /var/lib/mysql/mysqld-auto.cnf snapshot
And now we stop MySQL and empty the datadir:
$ sudo systemctl stop mysqld
$ sudo rm -rf /var/lib/mysql/*
Let's copy back the les from the snapshot and start MySQL:
$ sudo cp -r snapshot/* /var/lib/mysql
$ sudo chown -R mysql. /var/lib/mysql
$ sudo systemctl start mysqld
Copyright @ 2022 Oracle and/or its affiliates.
51
Restore Last Dump - CLONE (3)
We can see that the GTIDs are already in place:
SQL > select @@gtid_purged, @@gtid_executed;
+--------------------------------------+--------------------------------------+
| @@gtid_purged | @@gtid_executed |
+--------------------------------------+--------------------------------------+
| b00098d0-72eb-11ec-b8d2-...:1-581783 | b00098d0-72eb-11ec-b8d2-...:1-581783 |
+--------------------------------------+--------------------------------------+
Copyright @ 2022 Oracle and/or its affiliates.
52
Find the GTIDs to bypass
Now on the binary logs we have streamed, we need to nd the transaction(s) we want to
skip.
We use mysqlbinlog -v --base64-output=DECODE-ROWS <binlog le> with
grep to nd the right le. The timestamp on the le can of course help to dentify the right
le.
I found that the le is my-compute-binlog.000029.
Copyright @ 2022 Oracle and/or its affiliates.
53
Find the GTIDs to bypass
Now on the binary logs we have streamed, we need to nd the transaction(s) we want to
skip.
We use mysqlbinlog -v --base64-output=DECODE-ROWS <binlog le> with
grep to nd the right le. The timestamp on the le can of course help to dentify the right
le.
I found that the le is my-compute-binlog.000029.
Copyright @ 2022 Oracle and/or its affiliates.
53
Skip the GTIDs
It's time now to tell MySQL which GTIDs we want to avoid (only one in our example).
To do so, we will append to the GTID_PURGED the GTIDs we want to skip:
SQL > SET @@GLOBAL.gtid_purged = '+b00098d0-72eb-11ec-b8d2-0200170c7057:4716073';
Query OK, 0 rows affected (0.0045 sec)
SQL ฀ select @@gtid_purged, @@gtid_executedG
*************************** 1. row ***************************
@@gtid_purged: b00098d0-72eb-11ec-b8d2-0200170c7057:1-581783:4716073
@@gtid_executed: b00098d0-72eb-11ec-b8d2-0200170c7057:1-581783:4716073
Copyright @ 2022 Oracle and/or its affiliates.
54
Replay the Binary Logs
Now we could replay the binary logs one by one to our MySQL server... but that can lead to
a very long operation as mysqlbinlog is single-threaded.
Unfortunately, on a Cloud manage instance, this is the only feasible method:
$ mysqlbinlog my-compute-binlog.000002 | mysql
And repeat this for all binary logs...
Copyright @ 2022 Oracle and/or its affiliates.
55
Replay the Binary Logs... like a Rockstar !
We will let believe to MySQL that those streamed binary logs are relay logs !
Therefore, MySQL will be able to ingest them in parallel very quickly !
Copyright @ 2022 Oracle and/or its affiliates.
56
Replay the Binary Logs... like a Rockstar !
We will let believe to MySQL that those streamed binary logs are relay logs !
Therefore, MySQL will be able to ingest them in parallel very quickly !
SQL > select @@relay_log;
+----------------------+
| @@relay_log |
+----------------------+
| my-compute-relay-bin |
+----------------------+
Copyright @ 2022 Oracle and/or its affiliates.
56
Replay the Binary Logs... like a Rockstar ! (2)
Let's copy the les:
$ cd /mnt/binlog_streaming/data
$ for i in `ls *`; do
sudo cp $i /var/lib/mysql/my-compute-relay-bin.${i#*.}
done
$ chown mysql. /var/lib/mysql/my-compute-relay-bin.*
And of course we need to create the relay index le too:
$ cd /var/lib/mysql
$ sudo ls ./my-compute-relay-bin.* > my-compute-relay-bin.index
$ sudo chown mysql. my-compute-relay-bin.index
Copyright @ 2022 Oracle and/or its affiliates.
57
Replay the Binary Logs... like a Rockstar ! (3)
Let's verify that we can ingest to relay logs in parallel:
SQL > select @@replica_parallel_type, @@replica_parallel_workers;
+-------------------------+----------------------------+
| @@replica_parallel_type | @@replica_parallel_workers |
+-------------------------+----------------------------+
| LOGICAL_CLOCK | 4 |
+-------------------------+----------------------------+
This is enough on my system but don't hesitate to increase the threads if you have CPU
power.
If you can a ord a MySQL restart before and after pitr, it might be good to set log_replica_updates to 0.
Copyright @ 2022 Oracle and/or its affiliates.
58
Replay the Binary Logs... like a Rockstar ! (4)
And now... let's start !
SQL > SET GLOBAL server_id = 99;
Query OK, 0 rows affected (0.0003 sec)
SQL> SET GLOBAL binlog_transaction_dependency_tracking='writeset';
Query OK, 0 rows affected (0.0002 sec)
SQL > CHANGE REPLICATION SOURCE
TO RELAY_LOG_FILE='my-compute-relay-bin.000002',
RELAY_LOG_POS=4, SOURCE_HOST='dummy';
Query OK, 0 rows affected (0.1464 sec)
SQL > START REPLICA SQL_THREAD;
Query OK, 0 rows affected (0.0144 sec)
Copyright @ 2022 Oracle and/or its affiliates.
59
Replay the Binary Logs... like a Rockstar ! (5)
You can verify the progress in performance_schema in tables
replication_applier_status_by_coordinator and
replication_applier_status_by_worker:
SQL > SELECT LAST_APPLIED_TRANSACTION, APPLYING_TRANSACTION,
APPLYING_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP
FROM performance_schema.replication_applier_status_by_workerG
*************************** 1. row ***************************
LAST_APPLIED_TRANSACTION: b00098d0-72eb-11ec-b8d2-0200170c7057:607684
APPLYING_TRANSACTION: b00098d0-72eb-11ec-b8d2-0200170c7057:607685
APPLYING_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP: 2022-01-11 16:41:52.849261
*************************** 2. row ***************************
LAST_APPLIED_TRANSACTION: b00098d0-72eb-11ec-b8d2-0200170c7057:607369
APPLYING_TRANSACTION:
...
Copyright @ 2022 Oracle and/or its affiliates.
60
Test
Let's now verify...
SQL > select @@gtid_purged, @@gtid_executed;
+------------------------------------------------+----------------------------------+
| @@gtid_purged | @@gtid_executed |
+------------------------------------------------+----------------------------------+
| b00098d0-72eb-11ec-...:1-581783:735903-5854318 | b00098d0-72eb-11ec-...:1-5854318 |
+------------------------------------------------+----------------------------------+
Copyright @ 2022 Oracle and/or its affiliates.
61
Test
Let's now verify...
SQL > select @@gtid_purged, @@gtid_executed;
+------------------------------------------------+----------------------------------+
| @@gtid_purged | @@gtid_executed |
+------------------------------------------------+----------------------------------+
| b00098d0-72eb-11ec-...:1-581783:735903-5854318 | b00098d0-72eb-11ec-...:1-5854318 |
+------------------------------------------------+----------------------------------+
SQL > select (select count(*) from sbtest.sbtest1) t1,
... ,
(select count(*) from sbtest.sbtest8) t8;
+--------+--------+--------+--------+--------+--------+--------+--------+
| t1 | t2 | t3 | t4 | t5 | t6 | t7 | t8 |
+--------+--------+--------+--------+--------+--------+--------+--------+
| 667831 | 670327 | 669287 | 668361 | 668443 | 668736 | 670188 | 669557 |
+--------+--------+--------+--------+--------+--------+--------+--------+
Copyright @ 2022 Oracle and/or its affiliates.
61
Test (2)
And nally:
SQL > select * from fosdem.t1;
+----+----------+---------------------+---------+
| id | name | inserted | updated |
+----+----------+---------------------+---------+
| 1 | dave | 2022-01-11 15:01:27 | NULL |
| 2 | miguel | 2022-01-11 15:01:27 | NULL |
| 3 | kenny | 2022-01-11 15:01:27 | NULL |
| 4 | joro | 2022-01-11 15:01:27 | NULL |
| 5 | johannes | 2022-01-11 15:01:27 | NULL |
| 6 | lefred | 2022-01-12 15:44:08 | NULL |
+----+----------+---------------------+---------+
6 rows in set (0.0006 sec)
Don't forget to put back the initial value of server_id
Copyright @ 2022 Oracle and/or its affiliates.
62
Copyright @ 2022 Oracle and/or its affiliates.
And in the cloud ?
Se ing up your strategy in OCI
63
Strategy in OCI with MDS
VCN
10.0.0.0/16
Public Subnet
10.0.0.0/24
Private Subnet
10.0.1.0/24
MySQL Shell
MySQL
Database Service
Internet
Gateway
Oracle Cloud Infrastructure
Availability Domain 1
Fault Domain 1
mysql-dump-bucket
mysql-binlogs-bucket
Object Storage
dump instance
stream binlogs
Copyright @ 2022 Oracle and/or its affiliates.
64
Strategy in OCI with MDS (2)
Backups/snapshots are managed by the MySQL Team
Binary logs are purged every hour by default
You need to stream your Binary logs to Object Storage using a dedicated compute
instance
You can also perform logical dumps to Object Storage (not mandatory)
Copyright @ 2022 Oracle and/or its affiliates.
65
Strategy in OCI with MDS (3)
More details:
h ps://lefred.be/content/point-in-time-recovery-in-oci-mds-with-object-storage-part-
1/
h ps://lefred.be/content/point-in-time-recovery-in-oci-mds-with-object-storage-part-
2/
Copyright @ 2022 Oracle and/or its affiliates.
66
Questions ?
Copyright @ 2022 Oracle and/or its affiliates.
67

More Related Content

What's hot

Mysql Fun
Mysql FunMysql Fun
Mysql FunSHC
 
Oracle Developer Live: Deploying MySQL InnoDB Cluster on OCI with Terraform
Oracle Developer Live: Deploying MySQL InnoDB Cluster on OCI with TerraformOracle Developer Live: Deploying MySQL InnoDB Cluster on OCI with Terraform
Oracle Developer Live: Deploying MySQL InnoDB Cluster on OCI with TerraformFrederic Descamps
 
the State of the Dolphin - October 2020
the State of the Dolphin - October 2020the State of the Dolphin - October 2020
the State of the Dolphin - October 2020Frederic Descamps
 
Deploying Magento on OCI with MDS
Deploying Magento on OCI with MDSDeploying Magento on OCI with MDS
Deploying Magento on OCI with MDSFrederic Descamps
 
MySQL Database Service Webinar: Upgrading from on-premise MySQL to MDS
MySQL Database Service Webinar: Upgrading from on-premise MySQL to MDSMySQL Database Service Webinar: Upgrading from on-premise MySQL to MDS
MySQL Database Service Webinar: Upgrading from on-premise MySQL to MDSFrederic Descamps
 
Open Source 101 2022 - MySQL Indexes and Histograms
Open Source 101 2022 - MySQL Indexes and HistogramsOpen Source 101 2022 - MySQL Indexes and Histograms
Open Source 101 2022 - MySQL Indexes and HistogramsFrederic Descamps
 
MySQL Tech Café #8: MySQL 8.0 for Python Developers
MySQL Tech Café #8: MySQL 8.0 for Python DevelopersMySQL Tech Café #8: MySQL 8.0 for Python Developers
MySQL Tech Café #8: MySQL 8.0 for Python DevelopersFrederic Descamps
 
MySQL Group Replication: Handling Network Glitches - Best Practices
MySQL Group Replication: Handling Network Glitches - Best PracticesMySQL Group Replication: Handling Network Glitches - Best Practices
MySQL Group Replication: Handling Network Glitches - Best PracticesFrederic Descamps
 
MySQL InnoDB Cluster and Group Replication in a Nutshell
MySQL InnoDB Cluster and Group Replication in a NutshellMySQL InnoDB Cluster and Group Replication in a Nutshell
MySQL InnoDB Cluster and Group Replication in a NutshellFrederic Descamps
 
MySQL Group Replication - Ready For Production? (2018-04)
MySQL Group Replication - Ready For Production? (2018-04)MySQL Group Replication - Ready For Production? (2018-04)
MySQL Group Replication - Ready For Production? (2018-04)Kenny Gryp
 
MySQL 8.0 Document Store - Discovery of a New World
MySQL 8.0 Document Store - Discovery of a New WorldMySQL 8.0 Document Store - Discovery of a New World
MySQL 8.0 Document Store - Discovery of a New WorldFrederic Descamps
 
MySQL Indexes and Histograms - RMOUG Training Days 2022
MySQL Indexes and Histograms - RMOUG Training Days 2022MySQL Indexes and Histograms - RMOUG Training Days 2022
MySQL Indexes and Histograms - RMOUG Training Days 2022Dave Stokes
 
MySQL Connectors 8.0.19 & DNS SRV
MySQL Connectors 8.0.19 & DNS SRVMySQL Connectors 8.0.19 & DNS SRV
MySQL Connectors 8.0.19 & DNS SRVKenny Gryp
 
State of the Dolphin 2020 - 25th Anniversary of MySQL with 8.0.20
State of the Dolphin 2020 - 25th Anniversary of MySQL with 8.0.20State of the Dolphin 2020 - 25th Anniversary of MySQL with 8.0.20
State of the Dolphin 2020 - 25th Anniversary of MySQL with 8.0.20Frederic Descamps
 
Another MySQL HA Solution for ProxySQL Users, Easy and All Integrated: MySQL ...
Another MySQL HA Solution for ProxySQL Users, Easy and All Integrated: MySQL ...Another MySQL HA Solution for ProxySQL Users, Easy and All Integrated: MySQL ...
Another MySQL HA Solution for ProxySQL Users, Easy and All Integrated: MySQL ...Frederic Descamps
 
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11Kenny Gryp
 
Manual Tecnico OGG Oracle to MySQL
Manual Tecnico OGG Oracle to MySQLManual Tecnico OGG Oracle to MySQL
Manual Tecnico OGG Oracle to MySQLErick Vidbaz
 
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #5: Oracle’s InnoDB Cluster
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #5: Oracle’s InnoDB ClusterWebinar Slides: MySQL HA/DR/Geo-Scale - High Noon #5: Oracle’s InnoDB Cluster
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #5: Oracle’s InnoDB ClusterContinuent
 
Ohio Linux Fest -- MySQL's NoSQL
Ohio Linux Fest -- MySQL's NoSQLOhio Linux Fest -- MySQL's NoSQL
Ohio Linux Fest -- MySQL's NoSQLDave Stokes
 
MySQL Database Architectures - 2020-10
MySQL Database Architectures -  2020-10MySQL Database Architectures -  2020-10
MySQL Database Architectures - 2020-10Kenny Gryp
 

What's hot (20)

Mysql Fun
Mysql FunMysql Fun
Mysql Fun
 
Oracle Developer Live: Deploying MySQL InnoDB Cluster on OCI with Terraform
Oracle Developer Live: Deploying MySQL InnoDB Cluster on OCI with TerraformOracle Developer Live: Deploying MySQL InnoDB Cluster on OCI with Terraform
Oracle Developer Live: Deploying MySQL InnoDB Cluster on OCI with Terraform
 
the State of the Dolphin - October 2020
the State of the Dolphin - October 2020the State of the Dolphin - October 2020
the State of the Dolphin - October 2020
 
Deploying Magento on OCI with MDS
Deploying Magento on OCI with MDSDeploying Magento on OCI with MDS
Deploying Magento on OCI with MDS
 
MySQL Database Service Webinar: Upgrading from on-premise MySQL to MDS
MySQL Database Service Webinar: Upgrading from on-premise MySQL to MDSMySQL Database Service Webinar: Upgrading from on-premise MySQL to MDS
MySQL Database Service Webinar: Upgrading from on-premise MySQL to MDS
 
Open Source 101 2022 - MySQL Indexes and Histograms
Open Source 101 2022 - MySQL Indexes and HistogramsOpen Source 101 2022 - MySQL Indexes and Histograms
Open Source 101 2022 - MySQL Indexes and Histograms
 
MySQL Tech Café #8: MySQL 8.0 for Python Developers
MySQL Tech Café #8: MySQL 8.0 for Python DevelopersMySQL Tech Café #8: MySQL 8.0 for Python Developers
MySQL Tech Café #8: MySQL 8.0 for Python Developers
 
MySQL Group Replication: Handling Network Glitches - Best Practices
MySQL Group Replication: Handling Network Glitches - Best PracticesMySQL Group Replication: Handling Network Glitches - Best Practices
MySQL Group Replication: Handling Network Glitches - Best Practices
 
MySQL InnoDB Cluster and Group Replication in a Nutshell
MySQL InnoDB Cluster and Group Replication in a NutshellMySQL InnoDB Cluster and Group Replication in a Nutshell
MySQL InnoDB Cluster and Group Replication in a Nutshell
 
MySQL Group Replication - Ready For Production? (2018-04)
MySQL Group Replication - Ready For Production? (2018-04)MySQL Group Replication - Ready For Production? (2018-04)
MySQL Group Replication - Ready For Production? (2018-04)
 
MySQL 8.0 Document Store - Discovery of a New World
MySQL 8.0 Document Store - Discovery of a New WorldMySQL 8.0 Document Store - Discovery of a New World
MySQL 8.0 Document Store - Discovery of a New World
 
MySQL Indexes and Histograms - RMOUG Training Days 2022
MySQL Indexes and Histograms - RMOUG Training Days 2022MySQL Indexes and Histograms - RMOUG Training Days 2022
MySQL Indexes and Histograms - RMOUG Training Days 2022
 
MySQL Connectors 8.0.19 & DNS SRV
MySQL Connectors 8.0.19 & DNS SRVMySQL Connectors 8.0.19 & DNS SRV
MySQL Connectors 8.0.19 & DNS SRV
 
State of the Dolphin 2020 - 25th Anniversary of MySQL with 8.0.20
State of the Dolphin 2020 - 25th Anniversary of MySQL with 8.0.20State of the Dolphin 2020 - 25th Anniversary of MySQL with 8.0.20
State of the Dolphin 2020 - 25th Anniversary of MySQL with 8.0.20
 
Another MySQL HA Solution for ProxySQL Users, Easy and All Integrated: MySQL ...
Another MySQL HA Solution for ProxySQL Users, Easy and All Integrated: MySQL ...Another MySQL HA Solution for ProxySQL Users, Easy and All Integrated: MySQL ...
Another MySQL HA Solution for ProxySQL Users, Easy and All Integrated: MySQL ...
 
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
 
Manual Tecnico OGG Oracle to MySQL
Manual Tecnico OGG Oracle to MySQLManual Tecnico OGG Oracle to MySQL
Manual Tecnico OGG Oracle to MySQL
 
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #5: Oracle’s InnoDB Cluster
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #5: Oracle’s InnoDB ClusterWebinar Slides: MySQL HA/DR/Geo-Scale - High Noon #5: Oracle’s InnoDB Cluster
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #5: Oracle’s InnoDB Cluster
 
Ohio Linux Fest -- MySQL's NoSQL
Ohio Linux Fest -- MySQL's NoSQLOhio Linux Fest -- MySQL's NoSQL
Ohio Linux Fest -- MySQL's NoSQL
 
MySQL Database Architectures - 2020-10
MySQL Database Architectures -  2020-10MySQL Database Architectures -  2020-10
MySQL Database Architectures - 2020-10
 

Similar to FOSDEM 2022 MySQL Devroom: MySQL 8.0 - Logical Backups, Snapshots and Point-in-Time Recovery like a Rockstar

LinuxFest Northwest 2022 - The Evolution of a MySQL Database System
LinuxFest Northwest 2022 - The Evolution of a MySQL Database SystemLinuxFest Northwest 2022 - The Evolution of a MySQL Database System
LinuxFest Northwest 2022 - The Evolution of a MySQL Database SystemFrederic Descamps
 
Percona Live 2022 - The Evolution of a MySQL Database System
Percona Live 2022 - The Evolution of a MySQL Database SystemPercona Live 2022 - The Evolution of a MySQL Database System
Percona Live 2022 - The Evolution of a MySQL Database SystemFrederic Descamps
 
FOSDEM MySQL & Friends Devroom, February 2018 MySQL Point-in-Time Recovery l...
FOSDEM MySQL & Friends Devroom, February 2018  MySQL Point-in-Time Recovery l...FOSDEM MySQL & Friends Devroom, February 2018  MySQL Point-in-Time Recovery l...
FOSDEM MySQL & Friends Devroom, February 2018 MySQL Point-in-Time Recovery l...Frederic Descamps
 
State of the Dolphin - May 2022
State of the Dolphin - May 2022State of the Dolphin - May 2022
State of the Dolphin - May 2022Frederic Descamps
 
Percona Live 2022 - MySQL Architectures
Percona Live 2022 - MySQL ArchitecturesPercona Live 2022 - MySQL Architectures
Percona Live 2022 - MySQL ArchitecturesFrederic Descamps
 
MySQL docker with demo by Ramana Yeruva
MySQL docker with demo by Ramana YeruvaMySQL docker with demo by Ramana Yeruva
MySQL docker with demo by Ramana YeruvaMysql User Camp
 
20618782218718364253 emea12 vldb
20618782218718364253 emea12 vldb20618782218718364253 emea12 vldb
20618782218718364253 emea12 vldbLocuto Riorama
 
MySQL Enterprise Backup - BnR Scenarios
MySQL Enterprise Backup - BnR ScenariosMySQL Enterprise Backup - BnR Scenarios
MySQL Enterprise Backup - BnR ScenariosKeith Hollman
 
MySQL Database Architectures - 2022-08
MySQL Database Architectures - 2022-08MySQL Database Architectures - 2022-08
MySQL Database Architectures - 2022-08Kenny Gryp
 
Oracle Open World Presentation - Oracle RMAN Best Practices for Cloud Backups
Oracle Open World Presentation - Oracle RMAN Best Practices for Cloud Backups Oracle Open World Presentation - Oracle RMAN Best Practices for Cloud Backups
Oracle Open World Presentation - Oracle RMAN Best Practices for Cloud Backups Niklas Iveslatt
 
6212883126866262792 performance testing_cloud
6212883126866262792 performance testing_cloud6212883126866262792 performance testing_cloud
6212883126866262792 performance testing_cloudLocuto Riorama
 
Pi Day 2022 - from IoT to MySQL HeatWave Database Service
Pi Day 2022 -  from IoT to MySQL HeatWave Database ServicePi Day 2022 -  from IoT to MySQL HeatWave Database Service
Pi Day 2022 - from IoT to MySQL HeatWave Database ServiceFrederic Descamps
 
RMOUG 18 - Winning Performance Challenges in Oracle Multitenant
RMOUG 18 - Winning Performance Challenges in Oracle MultitenantRMOUG 18 - Winning Performance Challenges in Oracle Multitenant
RMOUG 18 - Winning Performance Challenges in Oracle MultitenantPini Dibask
 
InnoDB Cluster Experience (MySQL User Camp)
InnoDB Cluster Experience (MySQL User Camp)InnoDB Cluster Experience (MySQL User Camp)
InnoDB Cluster Experience (MySQL User Camp)Mydbops
 
MySQL InnoDB Cluster - Advanced Configuration & Operations
MySQL InnoDB Cluster - Advanced Configuration & OperationsMySQL InnoDB Cluster - Advanced Configuration & Operations
MySQL InnoDB Cluster - Advanced Configuration & OperationsFrederic Descamps
 
The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...
The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...
The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...Geir Høydalsvik
 
MySQL Innovation Day Chicago - MySQL HA So Easy : That's insane !!
MySQL Innovation Day Chicago  - MySQL HA So Easy : That's insane !!MySQL Innovation Day Chicago  - MySQL HA So Easy : That's insane !!
MySQL Innovation Day Chicago - MySQL HA So Easy : That's insane !!Frederic Descamps
 
MySQL Shell/AdminAPI - MySQL Architectures Made Easy For All!
MySQL Shell/AdminAPI - MySQL Architectures Made Easy For All!MySQL Shell/AdminAPI - MySQL Architectures Made Easy For All!
MySQL Shell/AdminAPI - MySQL Architectures Made Easy For All!Miguel Araújo
 

Similar to FOSDEM 2022 MySQL Devroom: MySQL 8.0 - Logical Backups, Snapshots and Point-in-Time Recovery like a Rockstar (20)

LinuxFest Northwest 2022 - The Evolution of a MySQL Database System
LinuxFest Northwest 2022 - The Evolution of a MySQL Database SystemLinuxFest Northwest 2022 - The Evolution of a MySQL Database System
LinuxFest Northwest 2022 - The Evolution of a MySQL Database System
 
Percona Live 2022 - The Evolution of a MySQL Database System
Percona Live 2022 - The Evolution of a MySQL Database SystemPercona Live 2022 - The Evolution of a MySQL Database System
Percona Live 2022 - The Evolution of a MySQL Database System
 
FOSDEM MySQL & Friends Devroom, February 2018 MySQL Point-in-Time Recovery l...
FOSDEM MySQL & Friends Devroom, February 2018  MySQL Point-in-Time Recovery l...FOSDEM MySQL & Friends Devroom, February 2018  MySQL Point-in-Time Recovery l...
FOSDEM MySQL & Friends Devroom, February 2018 MySQL Point-in-Time Recovery l...
 
State of the Dolphin - May 2022
State of the Dolphin - May 2022State of the Dolphin - May 2022
State of the Dolphin - May 2022
 
Percona Live 2022 - MySQL Architectures
Percona Live 2022 - MySQL ArchitecturesPercona Live 2022 - MySQL Architectures
Percona Live 2022 - MySQL Architectures
 
MySQL docker with demo by Ramana Yeruva
MySQL docker with demo by Ramana YeruvaMySQL docker with demo by Ramana Yeruva
MySQL docker with demo by Ramana Yeruva
 
20618782218718364253 emea12 vldb
20618782218718364253 emea12 vldb20618782218718364253 emea12 vldb
20618782218718364253 emea12 vldb
 
MySQL Enterprise Backup - BnR Scenarios
MySQL Enterprise Backup - BnR ScenariosMySQL Enterprise Backup - BnR Scenarios
MySQL Enterprise Backup - BnR Scenarios
 
MySQL Database Architectures - 2022-08
MySQL Database Architectures - 2022-08MySQL Database Architectures - 2022-08
MySQL Database Architectures - 2022-08
 
Oracle Open World Presentation - Oracle RMAN Best Practices for Cloud Backups
Oracle Open World Presentation - Oracle RMAN Best Practices for Cloud Backups Oracle Open World Presentation - Oracle RMAN Best Practices for Cloud Backups
Oracle Open World Presentation - Oracle RMAN Best Practices for Cloud Backups
 
6212883126866262792 performance testing_cloud
6212883126866262792 performance testing_cloud6212883126866262792 performance testing_cloud
6212883126866262792 performance testing_cloud
 
Pi Day 2022 - from IoT to MySQL HeatWave Database Service
Pi Day 2022 -  from IoT to MySQL HeatWave Database ServicePi Day 2022 -  from IoT to MySQL HeatWave Database Service
Pi Day 2022 - from IoT to MySQL HeatWave Database Service
 
Oracle Database 12c : Multitenant
Oracle Database 12c : MultitenantOracle Database 12c : Multitenant
Oracle Database 12c : Multitenant
 
RMOUG 18 - Winning Performance Challenges in Oracle Multitenant
RMOUG 18 - Winning Performance Challenges in Oracle MultitenantRMOUG 18 - Winning Performance Challenges in Oracle Multitenant
RMOUG 18 - Winning Performance Challenges in Oracle Multitenant
 
MySQL on Docker and Kubernetes
MySQL on Docker and KubernetesMySQL on Docker and Kubernetes
MySQL on Docker and Kubernetes
 
InnoDB Cluster Experience (MySQL User Camp)
InnoDB Cluster Experience (MySQL User Camp)InnoDB Cluster Experience (MySQL User Camp)
InnoDB Cluster Experience (MySQL User Camp)
 
MySQL InnoDB Cluster - Advanced Configuration & Operations
MySQL InnoDB Cluster - Advanced Configuration & OperationsMySQL InnoDB Cluster - Advanced Configuration & Operations
MySQL InnoDB Cluster - Advanced Configuration & Operations
 
The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...
The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...
The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...
 
MySQL Innovation Day Chicago - MySQL HA So Easy : That's insane !!
MySQL Innovation Day Chicago  - MySQL HA So Easy : That's insane !!MySQL Innovation Day Chicago  - MySQL HA So Easy : That's insane !!
MySQL Innovation Day Chicago - MySQL HA So Easy : That's insane !!
 
MySQL Shell/AdminAPI - MySQL Architectures Made Easy For All!
MySQL Shell/AdminAPI - MySQL Architectures Made Easy For All!MySQL Shell/AdminAPI - MySQL Architectures Made Easy For All!
MySQL Shell/AdminAPI - MySQL Architectures Made Easy For All!
 

More from Frederic Descamps

MySQL Innovation & Cloud Day - Document Store avec MySQL HeatWave Database Se...
MySQL Innovation & Cloud Day - Document Store avec MySQL HeatWave Database Se...MySQL Innovation & Cloud Day - Document Store avec MySQL HeatWave Database Se...
MySQL Innovation & Cloud Day - Document Store avec MySQL HeatWave Database Se...Frederic Descamps
 
MySQL Day Roma - MySQL Shell and Visual Studio Code Extension
MySQL Day Roma - MySQL Shell and Visual Studio Code ExtensionMySQL Day Roma - MySQL Shell and Visual Studio Code Extension
MySQL Day Roma - MySQL Shell and Visual Studio Code ExtensionFrederic Descamps
 
RivieraJUG - MySQL Indexes and Histograms
RivieraJUG - MySQL Indexes and HistogramsRivieraJUG - MySQL Indexes and Histograms
RivieraJUG - MySQL Indexes and HistogramsFrederic Descamps
 
RivieraJUG - MySQL 8.0 - What's new for developers.pdf
RivieraJUG - MySQL 8.0 - What's new for developers.pdfRivieraJUG - MySQL 8.0 - What's new for developers.pdf
RivieraJUG - MySQL 8.0 - What's new for developers.pdfFrederic Descamps
 
MySQL User Group NL - MySQL 8
MySQL User Group NL - MySQL 8MySQL User Group NL - MySQL 8
MySQL User Group NL - MySQL 8Frederic Descamps
 
Percona Live 2022 - MySQL Shell for Visual Studio Code
Percona Live 2022 - MySQL Shell for Visual Studio CodePercona Live 2022 - MySQL Shell for Visual Studio Code
Percona Live 2022 - MySQL Shell for Visual Studio CodeFrederic Descamps
 
Confoo 2022 - le cycle d'une instance MySQL
Confoo 2022  - le cycle d'une instance MySQLConfoo 2022  - le cycle d'une instance MySQL
Confoo 2022 - le cycle d'une instance MySQLFrederic Descamps
 
MySQL Database Service Webinar - Installing WordPress in OCI with MDS
MySQL Database Service Webinar - Installing WordPress in OCI with MDSMySQL Database Service Webinar - Installing WordPress in OCI with MDS
MySQL Database Service Webinar - Installing WordPress in OCI with MDSFrederic Descamps
 
MySQL Day Virtual: Best Practices Tips - Upgrading to MySQL 8.0
MySQL Day Virtual: Best Practices Tips - Upgrading to MySQL 8.0MySQL Day Virtual: Best Practices Tips - Upgrading to MySQL 8.0
MySQL Day Virtual: Best Practices Tips - Upgrading to MySQL 8.0Frederic Descamps
 
OpenExpo Virtual Experience 2020: MySQL 8.0 Document Store - Discovery of a n...
OpenExpo Virtual Experience 2020: MySQL 8.0 Document Store - Discovery of a n...OpenExpo Virtual Experience 2020: MySQL 8.0 Document Store - Discovery of a n...
OpenExpo Virtual Experience 2020: MySQL 8.0 Document Store - Discovery of a n...Frederic Descamps
 

More from Frederic Descamps (10)

MySQL Innovation & Cloud Day - Document Store avec MySQL HeatWave Database Se...
MySQL Innovation & Cloud Day - Document Store avec MySQL HeatWave Database Se...MySQL Innovation & Cloud Day - Document Store avec MySQL HeatWave Database Se...
MySQL Innovation & Cloud Day - Document Store avec MySQL HeatWave Database Se...
 
MySQL Day Roma - MySQL Shell and Visual Studio Code Extension
MySQL Day Roma - MySQL Shell and Visual Studio Code ExtensionMySQL Day Roma - MySQL Shell and Visual Studio Code Extension
MySQL Day Roma - MySQL Shell and Visual Studio Code Extension
 
RivieraJUG - MySQL Indexes and Histograms
RivieraJUG - MySQL Indexes and HistogramsRivieraJUG - MySQL Indexes and Histograms
RivieraJUG - MySQL Indexes and Histograms
 
RivieraJUG - MySQL 8.0 - What's new for developers.pdf
RivieraJUG - MySQL 8.0 - What's new for developers.pdfRivieraJUG - MySQL 8.0 - What's new for developers.pdf
RivieraJUG - MySQL 8.0 - What's new for developers.pdf
 
MySQL User Group NL - MySQL 8
MySQL User Group NL - MySQL 8MySQL User Group NL - MySQL 8
MySQL User Group NL - MySQL 8
 
Percona Live 2022 - MySQL Shell for Visual Studio Code
Percona Live 2022 - MySQL Shell for Visual Studio CodePercona Live 2022 - MySQL Shell for Visual Studio Code
Percona Live 2022 - MySQL Shell for Visual Studio Code
 
Confoo 2022 - le cycle d'une instance MySQL
Confoo 2022  - le cycle d'une instance MySQLConfoo 2022  - le cycle d'une instance MySQL
Confoo 2022 - le cycle d'une instance MySQL
 
MySQL Database Service Webinar - Installing WordPress in OCI with MDS
MySQL Database Service Webinar - Installing WordPress in OCI with MDSMySQL Database Service Webinar - Installing WordPress in OCI with MDS
MySQL Database Service Webinar - Installing WordPress in OCI with MDS
 
MySQL Day Virtual: Best Practices Tips - Upgrading to MySQL 8.0
MySQL Day Virtual: Best Practices Tips - Upgrading to MySQL 8.0MySQL Day Virtual: Best Practices Tips - Upgrading to MySQL 8.0
MySQL Day Virtual: Best Practices Tips - Upgrading to MySQL 8.0
 
OpenExpo Virtual Experience 2020: MySQL 8.0 Document Store - Discovery of a n...
OpenExpo Virtual Experience 2020: MySQL 8.0 Document Store - Discovery of a n...OpenExpo Virtual Experience 2020: MySQL 8.0 Document Store - Discovery of a n...
OpenExpo Virtual Experience 2020: MySQL 8.0 Document Store - Discovery of a n...
 

Recently uploaded

Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 

Recently uploaded (20)

Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 

FOSDEM 2022 MySQL Devroom: MySQL 8.0 - Logical Backups, Snapshots and Point-in-Time Recovery like a Rockstar

  • 1. Frédéric Descamps Community Manager MySQL February 2022 FOSDEM 2022 MySQL Devroom MySQL 8.0: Logical Backups, Snapshots and PITR like a rockstar
  • 2. Copyright @ 2022 Oracle and/or its affiliates. Who am I ? about.me/lefred 2
  • 3. Frédéric Descamps Copyright @ 2022 Oracle and/or its affiliates. @lefred MySQL Evangelist hacking MySQL since 3.21 devops believer living in h ps://lefred.be 3
  • 4. Copyright @ 2022 Oracle and/or its affiliates. 2022 best practices se ings 4
  • 5. I assume that your system is running MySQL 8.0.27 or later uses only InnoDB has binary logs enabled (required for PITR) binary logs must use ROW format uses GTID Copyright @ 2022 Oracle and/or its affiliates. 5
  • 6. Copyright @ 2022 Oracle and/or its affiliates. Point-in-Time Recovery using the binary logs 6
  • 7. Point-in-Time Recovery This is the technique whereby an administrator can restore or recover a set of data to a certain point usually in the past. In MySQL, point-in-time recovery consists in restoring a dump of the data and then replay the binary logs from and to a speci c point. This technique is used for: xing a problem live migration Copyright @ 2022 Oracle and/or its affiliates. 7
  • 8. Point-in-Time Recovery : how does it work ? day 1 BACKUPS Binlogs day 2 day 3 day 4 .001 .002 .003 .004 .005 .006 .007 .008 .009 .010 Copyright @ 2022 Oracle and/or its affiliates. 8
  • 9. Point-in-Time Recovery : how does it work ? day 1 BACKUPS Binlogs day 2 we want to recover at this point ! day 3 day 4 .001 .002 .003 .004 .005 .006 .007 .008 .009 .010 Copyright @ 2022 Oracle and/or its affiliates. 9
  • 10. Point-in-Time Recovery : how does it work ? day 1 BACKUPS Binlogs day 2 we want to recover at this point ! day 3 day 4 .001 .002 .003 .004 .005 .006 .007 .008 .009 .010 1. we restore the dump (of day3) Copyright @ 2022 Oracle and/or its affiliates. 10
  • 11. Point-in-Time Recovery : how does it work ? day 1 BACKUPS Binlogs day 2 day 3 day 4 .001 .002 .003 .004 .005 .006 .007 .008 .009 .010 1. we restore the dump (of day3) 2 . w e r e p l a y t h e binary logs (.008) Copyright @ 2022 Oracle and/or its affiliates. 11
  • 12. Point-in-Time Recovery : important concept Usually after a backup is made and veri ed, binary log les are purged from the MySQL server: Copyright @ 2022 Oracle and/or its affiliates. 12
  • 13. Point-in-Time Recovery : important concept Usually after a backup is made and veri ed, binary log les are purged from the MySQL server: Copyright @ 2022 Oracle and/or its affiliates. day 1 BACKUPS Binlogs day 2 day 3 day 4 .001 .002 .003 .004 .005 .006 .007 .008 .009 .010 12
  • 14. Point-in-Time Recovery : important concept Usually after a backup is made and veri ed, binary log les are purged from the MySQL server: Copyright @ 2022 Oracle and/or its affiliates. day 1 BACKUPS Binlogs day 2 day 3 day 4 .001 .002 .003 .004 .005 .006 .007 .008 .009 .010 day 1 BACKUPS recoverable points in time Binlogs day 2 day 3 day 4 .001 .002 .003 .004 .005 .006 .007 .008 .009 .010 } 12
  • 15. Point-in-Time Recovery : important concept (2) As you can see we can only recover to the exact time of the backups/dumps and do point- in-time recovery only from the last one ! This is why it's recommended to also stream the binary logs somewhere else (another server, a NAS, the cloud, ...). This will allow to make a point-in-time recovery at any point back in time: Copyright @ 2022 Oracle and/or its affiliates. 13
  • 16. Point-in-Time Recovery : important concept (2) As you can see we can only recover to the exact time of the backups/dumps and do point- in-time recovery only from the last one ! This is why it's recommended to also stream the binary logs somewhere else (another server, a NAS, the cloud, ...). This will allow to make a point-in-time recovery at any point back in time: Copyright @ 2022 Oracle and/or its affiliates. } day 1 BACKUPS recoverable points in time Binlogs day 2 day 3 day 4 .001 .002 .003 .004 .005 .001 .002 .003 .004 .005 .006 .007 .008 .009 .010 .006 .007 .008 .009 .010 b i n l o g s t r e a m i n g 13
  • 17. Point-in-Time Recovery for Fixing Something Why should we perform point-in-time recovery ? Copyright @ 2022 Oracle and/or its affiliates. 14
  • 18. Point-in-Time Recovery for Fixing Something Why should we perform point-in-time recovery ? a user made a mistake we need to nd back data from a certain point-in-time we need to have an overview of the database at a certain time Copyright @ 2022 Oracle and/or its affiliates. 14
  • 19. Point-in-Time Recovery for Live Migration When we do large migration (to the cloud for example), the load time can take longer than the binary log retention on the MySQL server that will be used as Replication Source. Then, Point-in-time recovery technique will be used to sync the future replica to be elligible for asynchronous replication. Copyright @ 2022 Oracle and/or its affiliates. 15
  • 20. Point-in-Time Recovery for Live Migration day 1 BACKUPS/DUMPS Binlogs day 2 day 3 day 4 .001 .002 .003 .004 .001 .002 .003 .004 b i n l o g s t r e a m i n g load started Copyright @ 2022 Oracle and/or its affiliates. 16
  • 21. Point-in-Time Recovery for Live Migration day 1 BACKUPS/DUMPS Binlogs day 2 day 3 day 4 b i n l o g s t r e a m i n g load finished .001 .002 .003 .004 .005 .006 .007 .008 .009 .010 .001 .002 .003 .004 .005 .006 .007 .008 .009 .010 dataset: gtid in .003 Copyright @ 2022 Oracle and/or its affiliates. 17
  • 22. Point-in-Time Recovery for Live Migration day 1 BACKUPS/DUMPS Binlogs day 2 day 3 day 4 b i n l o g s t r e a m i n g .001 .002 .003 .004 .005 .006 .007 .008 .009 .010 .001 .002 .003 .004 .005 .006 .007 .008 .009 .010 dataset: gtid in .003 r e p l a y f r o m . 0 0 3 to .010 Copyright @ 2022 Oracle and/or its affiliates. 18
  • 23. Point-in-Time Recovery for Live Migration day 1 BACKUPS/DUMPS Binlogs day 2 day 3 day 4 b i n l o g s t r e a m i n g .001 .002 .003 .004 .005 .006 .007 .008 .009 .010 .001 .002 .003 .004 .005 .006 .007 .008 .009 .010 dataset: gtid in .010 start replication Copyright @ 2022 Oracle and/or its affiliates. 19
  • 24. Copyright @ 2022 Oracle and/or its affiliates. Backups Physical, Logical, Snapshot, ... 20
  • 25. Backups For years, physical hot backups were recommended. With the increase in use of the cloud for MySQL, logical backups are coming back to the forefront. Copyright @ 2022 Oracle and/or its affiliates. 21
  • 26. Backups For years, physical hot backups were recommended. With the increase in use of the cloud for MySQL, logical backups are coming back to the forefront. First with mysqldump... but as you may know, this tool is not optimal. Single-threaded to dump and single-threaded to load the data. Copyright @ 2022 Oracle and/or its affiliates. 21
  • 27. Backups For years, physical hot backups were recommended. With the increase in use of the cloud for MySQL, logical backups are coming back to the forefront. First with mysqldump... but as you may know, this tool is not optimal. Single-threaded to dump and single-threaded to load the data. That's why, Oracle came up with MySQL Shell Dump & Load Utility ! Copyright @ 2022 Oracle and/or its affiliates. 21
  • 28. MySQL Shell Dump & Load Utility introduced with MySQL 8.0.21 supports export of all or selected schema supports local storage (could be a mount to S3) and OCI Object Storage natively supports dump from 5.6 (since 8.0.26), 5.7 and 8.0 can " x" your schema (force InnoDB, add an invisible primary key, ...) dumps and loads in parallel and more ... Copyright @ 2022 Oracle and/or its affiliates. 22
  • 29. The environment To illustrate the scenarios in this presentation, I use the following system: Copyright @ 2022 Oracle and/or its affiliates. Ampere compute instance (VM.Standard.A1.Flex, 4 OCPU, 24GB RAM) MySQL Server 8.0.27 MySQL Shell 8.0.27 sysbench 1.0.20 (generating load and data) a specify table to play: fosdem.t1 23
  • 30. Sysbench Copyright @ 2022 Oracle and/or its affiliates. 24
  • 31. Table t1 Copyright @ 2022 Oracle and/or its affiliates. 25
  • 32. Logical Dump As we plan to use our logical dump as a backup (or at least as an initial dump), we won't focus on a speci c schema but dump the full instance using util.dumpInstance(): Copyright @ 2022 Oracle and/or its affiliates. 26
  • 33. Logical Dump As we plan to use our logical dump as a backup (or at least as an initial dump), we won't focus on a speci c schema but dump the full instance using util.dumpInstance(): mysqlsh mysql://root@localhost -- util dump-instance backup-$(date +"%F") Copyright @ 2022 Oracle and/or its affiliates. 26
  • 34. Logical Dump (2) Copyright @ 2022 Oracle and/or its affiliates. 27
  • 35. The metadata of the dump is a very important le called @.json and it's located in the dump's directory: Logical Dump (3) - metadata Copyright @ 2022 Oracle and/or its affiliates. 28
  • 36. GTID - MySQL Shell Dump & Load Utility We can see that our dump is consistent and that the last GTID part of it is: "gtidExecuted": "b00098d0-72eb-11ec-b8d2-0200170c7057:1-129545", Copyright @ 2022 Oracle and/or its affiliates. 29
  • 37. GTID - MySQL Shell Dump & Load Utility We can see that our dump is consistent and that the last GTID part of it is: "gtidExecuted": "b00098d0-72eb-11ec-b8d2-0200170c7057:1-129545", On the MySQL Server, we can see that sysbench is still running and keeps generating data: SQL > select @@gtid_executed; +-----------------------------------------------+ | @@gtid_executed | +-----------------------------------------------+ | b00098d0-72eb-11ec-b8d2-0200170c7057:1-296244 | +-----------------------------------------------+ Copyright @ 2022 Oracle and/or its affiliates. 29
  • 38. Copyright @ 2022 Oracle and/or its affiliates. Snapshots physical hot dumps 30
  • 39. Physical Hot Snapshots There are multiple ways of doing Snapshots: Hot Backups (MEB, Xtrabackup): plenty of features, can be complicated to operate Filesystem snapshots: not always hot depending on the technique and the lesystem used. MySQL CLONE Copyright @ 2022 Oracle and/or its affiliates. 31
  • 40. CLONE Clone, introduced in MySQL 8.0.17, permits cloning data locally or from a remote MySQL server instance. Cloned data is a physical snapshot of data stored in InnoDB that includes schemas, tables, tablespaces, and data dictionary metadata. The cloned data comprises a fully functional data directory, which permits using clone for MySQL server provisioning. Copyright @ 2022 Oracle and/or its affiliates. 32
  • 41. CLONE Clone, introduced in MySQL 8.0.17, permits cloning data locally or from a remote MySQL server instance. Cloned data is a physical snapshot of data stored in InnoDB that includes schemas, tables, tablespaces, and data dictionary metadata. The cloned data comprises a fully functional data directory, which permits using clone for MySQL server provisioning. SQL > clone local data directory '/tmp/snapshot'; Query OK, 0 rows affected (5.6741 sec) Copyright @ 2022 Oracle and/or its affiliates. 32
  • 42. CLONE Clone, introduced in MySQL 8.0.17, permits cloning data locally or from a remote MySQL server instance. Cloned data is a physical snapshot of data stored in InnoDB that includes schemas, tables, tablespaces, and data dictionary metadata. The cloned data comprises a fully functional data directory, which permits using clone for MySQL server provisioning. SQL > clone local data directory '/tmp/snapshot'; Query OK, 0 rows affected (5.6741 sec) That's it ! As simple as that ! Copyright @ 2022 Oracle and/or its affiliates. 32
  • 43. CLONE - GTID The GTID of the snapshoted dataset can be found in performance_schema: SQL > select GTID_EXECUTED from clone_status; +-----------------------------------------------+ | GTID_EXECUTED | +-----------------------------------------------+ | b00098d0-72eb-11ec-b8d2-0200170c7057:1-581783 | +-----------------------------------------------+ Copyright @ 2022 Oracle and/or its affiliates. 33
  • 44. Copyright @ 2022 Oracle and/or its affiliates. Binary logs all the data changes are stored 34
  • 45. Binary Logs The MySQL workload is wri en in the binary log les: Copyright @ 2022 Oracle and/or its affiliates. 35
  • 46. Binary Logs The MySQL workload is wri en in the binary log les: Copyright @ 2022 Oracle and/or its affiliates. SQL > show binary logs; +---------------+-----------+-----------+ | Log_name | File_size | Encrypted | +---------------+-----------+-----------+ | binlog.000001 | 582 | No | | binlog.000002 | 200 | No | | binlog.000003 | 200 | No | | binlog.000004 | 782809684 | No | +---------------+-----------+-----------+ 4 rows in set (0.0059 sec) [root@my-compute ~]# ls -lh /var/lib/mysql/binlog.* -rw-r-----. 1 mysql mysql 582 Jan 11 14:36 /var/lib/mysql/binlog.000001 -rw-r-----. 1 mysql mysql 200 Jan 11 14:36 /var/lib/mysql/binlog.000002 -rw-r-----. 1 mysql mysql 200 Jan 11 14:36 /var/lib/mysql/binlog.000003 -rw-r-----. 1 mysql mysql 758M Jan 11 16:08 /var/lib/mysql/binlog.000004 -rw-r-----. 1 mysql mysql 64 Jan 11 14:36 /var/lib/mysql/binlog.index # let's divide the max size by 10 to have more logs to test SQL > set persist max_binlog_size=107374182; 35
  • 47. .001 .002 .003 .004 .005 .006 .007 .008 .009 .010 b i n l o g s t r e a m i n g mysqlbinlog has the possibility of reading the binary logs from a live server and store them to disk using the options --raw -- read-from-remote-server. we create a script to use mysqlbinlog : binlog_to_local.sh we use systemd to start and stop our script sources: h ps://tinyurl.com/binlogstream Keeping binlogs safe Copyright @ 2022 Oracle and/or its affiliates. 36
  • 48. Keeping binlogs safe (2) We rst need to create a dedicated user for our streaming process: SQL> CREATE USER 'binlog_streamer' IDENTIFIED BY 'C0mpl1c4t3d!Passw0rd' REQUIRE SSL; SQL> GRANT REPLICATION SLAVE ON *.* TO 'binlog_streamer'; SQL> GRANT SELECT ON performance_schema. le_instances TO 'binlog_streamer'; Copyright @ 2022 Oracle and/or its affiliates. 37
  • 49. Keeping binlogs safe (2) We rst need to create a dedicated user for our streaming process: SQL> CREATE USER 'binlog_streamer' IDENTIFIED BY 'C0mpl1c4t3d!Passw0rd' REQUIRE SSL; SQL> GRANT REPLICATION SLAVE ON *.* TO 'binlog_streamer'; SQL> GRANT SELECT ON performance_schema. le_instances TO 'binlog_streamer'; And to avoid to store credentials in our script, let's use MySQL Con g Editor : $ mysql_con g_editor set --login-path=localhost --host=127.0.0.1 --user=binlog_streamer --password Enter password: Copyright @ 2022 Oracle and/or its affiliates. 37
  • 50. Keeping binlogs safe (3) We can start the streaming using systemd: Copyright @ 2022 Oracle and/or its affiliates. 38
  • 51. Keeping binlogs safe (4) The les are now also saved somewhere else (this can be another server of course): Copyright @ 2022 Oracle and/or its affiliates. 39
  • 52. Copyright @ 2022 Oracle and/or its affiliates. Point-in-Time Recovery examples 40
  • 53. Something we would like to avoid... Copyright @ 2022 Oracle and/or its affiliates. 41
  • 54. Something we would like to avoid... Copyright @ 2022 Oracle and/or its affiliates. 41
  • 55. Restore last dump Start Replication Configure replication Replay binlogs(*) find the GTIDs of the transactions we want to bypass set GTID_PURGED to dump's GTID_EXECUTED append the GTIDs to GTID_PURGED Do we use another instance? Yes No The Action Plan Copyright @ 2022 Oracle and/or its affiliates. 42
  • 56. Restore last dump Start Replication Configure replication Replay binlogs(*) find the GTIDs of the transactions we want to bypass set GTID_PURGED to dump's GTID_EXECUTED append the GTIDs to GTID_PURGED Do we use another instance? Yes No The Action Plan I chose to perform point-in-time recovery on the same machine to show how we can accelerate the process. Copyright @ 2022 Oracle and/or its affiliates. 42
  • 57. Before we start Some actions are necessary before we start the point-in-time recovery process: if you plan to do point-in-time recovery on the same instance, you need to stop the application (sysbench in our case) we check the last GTID_EXECUTED we do select count(*) on the sysbench tables just to have an estimation we recovered as expected. stop the binlog streaming process Copyright @ 2022 Oracle and/or its affiliates. 43
  • 58. Before we start (2) SQL > select @@GTID_EXECUTED; +------------------------------------------------+ | @@GTID_EXECUTED | +------------------------------------------------+ | b00098d0-72eb-11ec-b8d2-0200170c7057:1-5854318 | +------------------------------------------------+ SQL > select (select count(*) from sbtest.sbtest1) t1, ... , (select count(*) from sbtest.sbtest8) t8; +--------+--------+--------+--------+--------+--------+--------+--------+ | t1 | t2 | t3 | t4 | t5 | t6 | t7 | t8 | +--------+--------+--------+--------+--------+--------+--------+--------+ | 667831 | 670327 | 669287 | 668361 | 668443 | 668736 | 670188 | 669557 | +--------+--------+--------+--------+--------+--------+--------+--------+ $ sudo systemctl stop binlog_streaming@localhost.service Copyright @ 2022 Oracle and/or its affiliates. 44
  • 59. Restore Last Dump We have again serveral options: restore the logical dump made with MySQL Shell restore the snapshot made with CLONE. Copyright @ 2022 Oracle and/or its affiliates. 45
  • 60. Restore Last Dump - MySQL Shell Utility To restore a dump made with MySQL Shell Dump Utility, we need a MySQL server running. We need to remove all non system schemas: SQL > drop schema fosdem; Query OK, 1 row affected (0.0225 sec) SQL > drop schema sbtest; Query OK, 8 rows affected (0.2117 sec) Copyright @ 2022 Oracle and/or its affiliates. 46
  • 61. Restore Last Dump - MySQL Shell Utility (2) $ mysqlsh mysql://root@localhost -- util load-dump backup-2022-01-11 --showMetadata --skipBinlog Loading DDL and Data from 'backup-2022-01-11' using 4 threads. Opening dump... --- Dump_metadata: Binlog_ le: binlog.000004 Binlog_position: 302256358 Executed_GTID_set: b00098d0-72eb-11ec-b8d2-0200170c7057:1-129545 Target is MySQL 8.0.27. Dump was produced from MySQL 8.0.27 Scanning metadata - done ... chunks (400.00K rows, 76.71 MB) for 9 tables in 2 schemas were loaded in 7 sec (avg throughput 11.33 MB/s) 0 warnings were reported during the load. Copyright @ 2022 Oracle and/or its affiliates. 47
  • 62. Restore Last Dump - MySQL Shell Utility (3) We can already check if our table looks like what it was before the dump: SQL > select * from t1; +----+----------+---------------------+---------+ | id | name | inserted | updated | +----+----------+---------------------+---------+ | 1 | dave | 2022-01-11 15:01:27 | NULL | | 2 | miguel | 2022-01-11 15:01:27 | NULL | | 3 | kenny | 2022-01-11 15:01:27 | NULL | | 4 | joro | 2022-01-11 15:01:27 | NULL | | 5 | johannes | 2022-01-11 15:01:27 | NULL | +----+----------+---------------------+---------+ 5 rows in set (0.0005 sec) Copyright @ 2022 Oracle and/or its affiliates. 48
  • 63. Restore Last Dump - MySQL Shell Utility (4) We still need to set back the GTIDs: SQL > select @@gtid_purged, @@gtid_executed; +---------------+------------------------------------------------+ | @@gtid_purged | @@gtid_executed | +---------------+------------------------------------------------+ | | b00098d0-72eb-11ec-b8d2-0200170c7057:1-5854320 | +---------------+------------------------------------------------+ Copyright @ 2022 Oracle and/or its affiliates. 49
  • 64. Restore Last Dump - MySQL Shell Utility (4) We still need to set back the GTIDs: SQL > select @@gtid_purged, @@gtid_executed; +---------------+------------------------------------------------+ | @@gtid_purged | @@gtid_executed | +---------------+------------------------------------------------+ | | b00098d0-72eb-11ec-b8d2-0200170c7057:1-5854320 | +---------------+------------------------------------------------+ SQL > reset master; SQL > set global gtid_purged='b00098d0-72eb-11ec-b8d2-0200170c7057:1-129545'; SQL > select @@gtid_purged, @@gtid_executed; +---------------------------------+--------------------------------------+ | @@gtid_purged | @@gtid_executed | +---------------------------------+--------------------------------------+ | b00098d0-72eb-11ec-...:1-129545 | b00098d0-72eb-11ec-b8d2-...:1-129545 | +---------------------------------+--------------------------------------+ Copyright @ 2022 Oracle and/or its affiliates. 49
  • 65. Restore Last Dump - CLONE As the plan is to retore the snapshot on the same server, we need rst to save 2 imporant les from MySQL's data directory: auto.cnf: containing the server-uuid mysqld-auto.cnf: containing all con guration changes done using SET PERSIST additionnaly if you have your own dedicated keys in the datadir, you should also save them Copyright @ 2022 Oracle and/or its affiliates. 50
  • 66. Restore Last Dump - CLONE (2) Let's starti by saving the required les: $ sudo cp /var/lib/mysql/auto.cnf snapshot $ sudo cp /var/lib/mysql/mysqld-auto.cnf snapshot Copyright @ 2022 Oracle and/or its affiliates. 51
  • 67. Restore Last Dump - CLONE (2) Let's starti by saving the required les: $ sudo cp /var/lib/mysql/auto.cnf snapshot $ sudo cp /var/lib/mysql/mysqld-auto.cnf snapshot And now we stop MySQL and empty the datadir: $ sudo systemctl stop mysqld $ sudo rm -rf /var/lib/mysql/* Copyright @ 2022 Oracle and/or its affiliates. 51
  • 68. Restore Last Dump - CLONE (2) Let's starti by saving the required les: $ sudo cp /var/lib/mysql/auto.cnf snapshot $ sudo cp /var/lib/mysql/mysqld-auto.cnf snapshot And now we stop MySQL and empty the datadir: $ sudo systemctl stop mysqld $ sudo rm -rf /var/lib/mysql/* Let's copy back the les from the snapshot and start MySQL: $ sudo cp -r snapshot/* /var/lib/mysql $ sudo chown -R mysql. /var/lib/mysql $ sudo systemctl start mysqld Copyright @ 2022 Oracle and/or its affiliates. 51
  • 69. Restore Last Dump - CLONE (3) We can see that the GTIDs are already in place: SQL > select @@gtid_purged, @@gtid_executed; +--------------------------------------+--------------------------------------+ | @@gtid_purged | @@gtid_executed | +--------------------------------------+--------------------------------------+ | b00098d0-72eb-11ec-b8d2-...:1-581783 | b00098d0-72eb-11ec-b8d2-...:1-581783 | +--------------------------------------+--------------------------------------+ Copyright @ 2022 Oracle and/or its affiliates. 52
  • 70. Find the GTIDs to bypass Now on the binary logs we have streamed, we need to nd the transaction(s) we want to skip. We use mysqlbinlog -v --base64-output=DECODE-ROWS <binlog le> with grep to nd the right le. The timestamp on the le can of course help to dentify the right le. I found that the le is my-compute-binlog.000029. Copyright @ 2022 Oracle and/or its affiliates. 53
  • 71. Find the GTIDs to bypass Now on the binary logs we have streamed, we need to nd the transaction(s) we want to skip. We use mysqlbinlog -v --base64-output=DECODE-ROWS <binlog le> with grep to nd the right le. The timestamp on the le can of course help to dentify the right le. I found that the le is my-compute-binlog.000029. Copyright @ 2022 Oracle and/or its affiliates. 53
  • 72. Skip the GTIDs It's time now to tell MySQL which GTIDs we want to avoid (only one in our example). To do so, we will append to the GTID_PURGED the GTIDs we want to skip: SQL > SET @@GLOBAL.gtid_purged = '+b00098d0-72eb-11ec-b8d2-0200170c7057:4716073'; Query OK, 0 rows affected (0.0045 sec) SQL ฀ select @@gtid_purged, @@gtid_executedG *************************** 1. row *************************** @@gtid_purged: b00098d0-72eb-11ec-b8d2-0200170c7057:1-581783:4716073 @@gtid_executed: b00098d0-72eb-11ec-b8d2-0200170c7057:1-581783:4716073 Copyright @ 2022 Oracle and/or its affiliates. 54
  • 73. Replay the Binary Logs Now we could replay the binary logs one by one to our MySQL server... but that can lead to a very long operation as mysqlbinlog is single-threaded. Unfortunately, on a Cloud manage instance, this is the only feasible method: $ mysqlbinlog my-compute-binlog.000002 | mysql And repeat this for all binary logs... Copyright @ 2022 Oracle and/or its affiliates. 55
  • 74. Replay the Binary Logs... like a Rockstar ! We will let believe to MySQL that those streamed binary logs are relay logs ! Therefore, MySQL will be able to ingest them in parallel very quickly ! Copyright @ 2022 Oracle and/or its affiliates. 56
  • 75. Replay the Binary Logs... like a Rockstar ! We will let believe to MySQL that those streamed binary logs are relay logs ! Therefore, MySQL will be able to ingest them in parallel very quickly ! SQL > select @@relay_log; +----------------------+ | @@relay_log | +----------------------+ | my-compute-relay-bin | +----------------------+ Copyright @ 2022 Oracle and/or its affiliates. 56
  • 76. Replay the Binary Logs... like a Rockstar ! (2) Let's copy the les: $ cd /mnt/binlog_streaming/data $ for i in `ls *`; do sudo cp $i /var/lib/mysql/my-compute-relay-bin.${i#*.} done $ chown mysql. /var/lib/mysql/my-compute-relay-bin.* And of course we need to create the relay index le too: $ cd /var/lib/mysql $ sudo ls ./my-compute-relay-bin.* > my-compute-relay-bin.index $ sudo chown mysql. my-compute-relay-bin.index Copyright @ 2022 Oracle and/or its affiliates. 57
  • 77. Replay the Binary Logs... like a Rockstar ! (3) Let's verify that we can ingest to relay logs in parallel: SQL > select @@replica_parallel_type, @@replica_parallel_workers; +-------------------------+----------------------------+ | @@replica_parallel_type | @@replica_parallel_workers | +-------------------------+----------------------------+ | LOGICAL_CLOCK | 4 | +-------------------------+----------------------------+ This is enough on my system but don't hesitate to increase the threads if you have CPU power. If you can a ord a MySQL restart before and after pitr, it might be good to set log_replica_updates to 0. Copyright @ 2022 Oracle and/or its affiliates. 58
  • 78. Replay the Binary Logs... like a Rockstar ! (4) And now... let's start ! SQL > SET GLOBAL server_id = 99; Query OK, 0 rows affected (0.0003 sec) SQL> SET GLOBAL binlog_transaction_dependency_tracking='writeset'; Query OK, 0 rows affected (0.0002 sec) SQL > CHANGE REPLICATION SOURCE TO RELAY_LOG_FILE='my-compute-relay-bin.000002', RELAY_LOG_POS=4, SOURCE_HOST='dummy'; Query OK, 0 rows affected (0.1464 sec) SQL > START REPLICA SQL_THREAD; Query OK, 0 rows affected (0.0144 sec) Copyright @ 2022 Oracle and/or its affiliates. 59
  • 79. Replay the Binary Logs... like a Rockstar ! (5) You can verify the progress in performance_schema in tables replication_applier_status_by_coordinator and replication_applier_status_by_worker: SQL > SELECT LAST_APPLIED_TRANSACTION, APPLYING_TRANSACTION, APPLYING_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP FROM performance_schema.replication_applier_status_by_workerG *************************** 1. row *************************** LAST_APPLIED_TRANSACTION: b00098d0-72eb-11ec-b8d2-0200170c7057:607684 APPLYING_TRANSACTION: b00098d0-72eb-11ec-b8d2-0200170c7057:607685 APPLYING_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP: 2022-01-11 16:41:52.849261 *************************** 2. row *************************** LAST_APPLIED_TRANSACTION: b00098d0-72eb-11ec-b8d2-0200170c7057:607369 APPLYING_TRANSACTION: ... Copyright @ 2022 Oracle and/or its affiliates. 60
  • 80. Test Let's now verify... SQL > select @@gtid_purged, @@gtid_executed; +------------------------------------------------+----------------------------------+ | @@gtid_purged | @@gtid_executed | +------------------------------------------------+----------------------------------+ | b00098d0-72eb-11ec-...:1-581783:735903-5854318 | b00098d0-72eb-11ec-...:1-5854318 | +------------------------------------------------+----------------------------------+ Copyright @ 2022 Oracle and/or its affiliates. 61
  • 81. Test Let's now verify... SQL > select @@gtid_purged, @@gtid_executed; +------------------------------------------------+----------------------------------+ | @@gtid_purged | @@gtid_executed | +------------------------------------------------+----------------------------------+ | b00098d0-72eb-11ec-...:1-581783:735903-5854318 | b00098d0-72eb-11ec-...:1-5854318 | +------------------------------------------------+----------------------------------+ SQL > select (select count(*) from sbtest.sbtest1) t1, ... , (select count(*) from sbtest.sbtest8) t8; +--------+--------+--------+--------+--------+--------+--------+--------+ | t1 | t2 | t3 | t4 | t5 | t6 | t7 | t8 | +--------+--------+--------+--------+--------+--------+--------+--------+ | 667831 | 670327 | 669287 | 668361 | 668443 | 668736 | 670188 | 669557 | +--------+--------+--------+--------+--------+--------+--------+--------+ Copyright @ 2022 Oracle and/or its affiliates. 61
  • 82. Test (2) And nally: SQL > select * from fosdem.t1; +----+----------+---------------------+---------+ | id | name | inserted | updated | +----+----------+---------------------+---------+ | 1 | dave | 2022-01-11 15:01:27 | NULL | | 2 | miguel | 2022-01-11 15:01:27 | NULL | | 3 | kenny | 2022-01-11 15:01:27 | NULL | | 4 | joro | 2022-01-11 15:01:27 | NULL | | 5 | johannes | 2022-01-11 15:01:27 | NULL | | 6 | lefred | 2022-01-12 15:44:08 | NULL | +----+----------+---------------------+---------+ 6 rows in set (0.0006 sec) Don't forget to put back the initial value of server_id Copyright @ 2022 Oracle and/or its affiliates. 62
  • 83. Copyright @ 2022 Oracle and/or its affiliates. And in the cloud ? Se ing up your strategy in OCI 63
  • 84. Strategy in OCI with MDS VCN 10.0.0.0/16 Public Subnet 10.0.0.0/24 Private Subnet 10.0.1.0/24 MySQL Shell MySQL Database Service Internet Gateway Oracle Cloud Infrastructure Availability Domain 1 Fault Domain 1 mysql-dump-bucket mysql-binlogs-bucket Object Storage dump instance stream binlogs Copyright @ 2022 Oracle and/or its affiliates. 64
  • 85. Strategy in OCI with MDS (2) Backups/snapshots are managed by the MySQL Team Binary logs are purged every hour by default You need to stream your Binary logs to Object Storage using a dedicated compute instance You can also perform logical dumps to Object Storage (not mandatory) Copyright @ 2022 Oracle and/or its affiliates. 65
  • 86. Strategy in OCI with MDS (3) More details: h ps://lefred.be/content/point-in-time-recovery-in-oci-mds-with-object-storage-part- 1/ h ps://lefred.be/content/point-in-time-recovery-in-oci-mds-with-object-storage-part- 2/ Copyright @ 2022 Oracle and/or its affiliates. 66
  • 87. Questions ? Copyright @ 2022 Oracle and/or its affiliates. 67