SlideShare a Scribd company logo
1 of 61
Download to read offline
MySQL Backups
Federico Razzoli
€ whoami
● Federico Razzoli
● Freelance consultant
● Working with databases since 2000
hello@federico-razzoli.com
federico-razzoli.com
● I worked as a consultant for Percona and Ibuildings
(mainly MySQL and MariaDB)
● I worked as a DBA for fast-growing companies like
Catawiki, HumanState, TransferWise
Agenda
● We’ll talk about different MySQL/MariaDB backup types and their
characteristics
● Not many details about each solution
● We’ll also talk about planning backup strategies and testing backups
Planning Backups
Before Planning...
● Evaluate costs
● Evaluate risks
● Define Backup strategies
Costs
● Everything that increases your reliability:
○ Costs money.
○ Produces no money.
● Managers understand this very well and keep it in mind when you talk about
backups
Costs
● Disasters:
○ Cost money.
○ Produces no money.
● Reduce disaster probability
○ Avoiding them is impossible
● Limit the damage they make
○ Serious Backup Strategies
● Then what is the “right” amount of money to spend for backups?
Data Loss Costs
● Cost to re-acquire data (if possible)
● Cost of services/products that cannot be sold
● Lifetime value of lost customers that are lost or not acquired
● Reputation cost, disappointed candidates…
Downtime Costs
is the cost of the time elapsed until a backup is restored
and the services back to life
● Cost of unsold services/products
● Lifetime value of customers that won’t return
● Reputation cost, Google rank, disappointed candidates...
Evaluate risks
● “If data is lost” is not a risk, it’s a generic concern
● Risks are, for example:
○ We drop a wrong table by mistake
○ Application deletes useful data because of a bug
○ A table gets corrupted during a write
○ Disk gets corrupted after a hardware failure
○ Cloud vendor is down
○ …
● Different risks are prevented in different ways
Defining Backup Strategies
● For each strategy, decide:
○ How the backup is taken
○ How often
○ Where the backup is stored
○ For how much time
○ How much time the backup can take
○ How much space the backup can take
○ How much time the restore can take
● You can easily see how some of these questions are inter-dependent
● You can have multiple backup levels:
○ Latest backup stored locally, uncompressed
○ 7 Daily backups in S3
Backup Types
Cold vs Hot
● Cold: stop MySQL and copy data
○ Downtime
○ Faster
● Hot: take backups while MySQL is running
○ Slow down
○ More complex
Physical vs Logical
● Physical: Set of files and directory
○ Usually takes more space (indexes are included)
○ Doing it while the server is running requires tools
● Logical: SQL statements to recreate a dataset
○ Can only be Hot
○ Can potentially be restored on any MySQL/MariaDB version
■ ...and even different SQL databases
○ Takes more time to take backup and to restore it
○ Inconsistent OR long transaction
Complete vs Partial
● Complete: All data
● Partial: A selected part of data
○ One or more databases
○ One or more tables from a database
○ Result of a SELECT (only Logical backup)
Full vs Incremental
● Full: A backup of data at a certain point in time
○ A Full backup can take a long time
○ Suppose you take it every 24 hours. In case of disaster, you could lose
up to 24 hours of changes
● Incremental
○ Taking an incremental backup normally takes much less time
○ It includes the changes that happened after the last full backup
○ If there is a hole between the full backup and the oldest changes we
have, our incremental backups are useless
Backups and Replication
Galera and Group Replication
● Often it makes sense to leave one node unused, and leave it available for
failover
● Backups can be taken from this node
Async Slaves
● It is a common practice to take backups from slaves
● But remember that slaves can lag
● If a slave is unused, it can be stopped to take cold backups
● MySQL and MariaDB support delayed replication
● Useful in case of human mistakes
Logical Backups
mysqldump
mysqldump [options] > dump.sql
mysql < dump.sql
● The dump file contains CREATE and INSERT statements
● Part of the syntax is enclosed in executable statements:
/*!080000 ... */
/*M!100400 ... */
mysqldump
● Monothread - slow!
● CREATE TABLEs include indexes - restore is slow!
● Many options to include/exclude tables/databases
● --where
● --no-data
● --triggers, --routines, --events
● Inconsistent by default. Use --single-transaction
○ MariaDB uses savepoints to unlock backuped rows
● For big tables use --quick
mysqlpump
● Comes with MySQL 5.7+, not in MariaDB
● Very similar to mysqldump
● Multi-thread, produces multiple files reloadable as normal dumps
● Option to compress the resulted files (cannot mysqlpump | gzip)
● Indexes are created after INSERT
● Users are dumped as CREATE USER
mydumper, myloader
● Multiple files per table:
--threads 4 --rows 100000
How it works:
● Master thread connects MySQL/MariaDB and runs
FLUSH TABLES WITH READ LOCK;
● Worker threads connect and run
START TRANSACTION WITH CONSISTENT SNAPSHOT;
● Master thread:
UNLOCK TABLES;
● Worker threads copy all data
mydumper, myloader
Other important options:
● --no-data
● --triggers, --routines, --events
● --compress
● --trx-consistency-only if you only dump InnoDB tables
● Use myloader to restore
○ --thread 4
Non-Transactional Tables
● (MyISAM, Aria, ARCHIVE…)
● To get a consistent dump, tables must be locked with LOCK TABLES
Temporal Tables
● MariaDB feature to track how data change over time
● Temporal tables have timestamp columns that define when a row version
validity started and when it ended
● If we create those columns explicitly, they are visible
● If those columns are visible and included in the dumps, dumps cannot be
restored
● Otherwise, the original timestamps will be lost
SHOW CREATE
● To get more flexibility, you can also write a script that uses SHOW CREATE
statements
● They return the CREATE statements to create an identical object (without
data)
● SHOW DATABASES; SHOW CREATE DATABASE;
● SHOW TABLES; SHOW CREATE TABLE;
● SHOW VIEWS; SHOW CREATE VIEW;
● SHOW TRIGGERS; SHOW CREATE TRIGGER;
● ...
Physical Backups
Cold Backups
● Copy the files to somewhere else
● This includes configuration files, etc
● MySQL must not be running
○ OR, you can make sure it is not writing to files:
○ STOP SLAVE;
○ FLUSH TABLES WITH READ LOCK;
○ Copy
○ UNLOCK TABLES;
○ START SLAVE;
● The copy can be done incrementally, by using rsync
Snapshots
● Snapshots are not a MySQL/MariaDB feature
● They can be implemented in an underlying technology: volume manager
(lvm), filesystem (zfs), Virtual Machine, Container
○ Your cloud provider most probably provides snapshots
○ but check documentation
● Existing files are frozen. They are the snapshots
● Everything written to disk afterwards is written separately (CoW), leaving the
current files intact
● Snapshots can be incremental - only contains changes since the previous
snapshot
● Snapshots can be sent to other servers
● Windows has Shadow Copies
Restoring Snapshots
● When mysqld or the filesystem suddenly crashes, it leaves inconsistent files
○ InnoDB tables (depending on configuration) don’t lose data, but tables
must be repaired on restart using the information stored in redo log and
undo log
○ MyISAM tables lose changes not flushed at the time of the crash
● When you take a snapshot it’s the same: you take a frozen copy of
inconsistent files (if mysqld was running)
● Restoring a backup implies that when mysqld is restarted tables will be
repaired
InnoDB
Transportable Tablespaces
Transportable Tablespaces
● Works for InnoDB tables contained in a dedicated file
● Allows to copy a table from another server that runs the same MySQL version
Source server:
● Run: FLUSH TABLES my_table FOR EXPORT;
● Copy the table file (.ibd) or take a snapshot
Target server:
● Run:
ALTER TABLE my_table DISCARD TABLESPACE;
● Copy the table
● Run:
ALTER TABLE my_table IMPORT TABLESPACE;
xtrabackup
xtrabackup
● xtrabackup is a tool to copy files while the server is running, without locking
InnoDB tables
● Produced by Percona
● Focus on MySQL
● Only works on Linux
xtrabackup
● xtrabackup is a tool to copy files while the server is running, without locking
InnoDB tables
● Produced by Percona
● Focus on MySQL, no support for MariaDB where it is incompatible with
MySQL
● Only works on Linux, no Windows support
mariabackup
● Introduced in MariaDB 10.1
● Fork of Xtrabackup 2.3
● Supports all MariaDB features
● Run on both Linux and Windows
Xtrabackup 8
● MySQL 8.0.20 (April 2020) introduced a Redo Log format change
(despite being a GA version)
● This break Xtrabackup compatibility
● Percona is working on a new release that understands the new Redo Log
PXB-2167 - Pending Release
You can subscribe to the issue
Taking a Full Backup
● Take a full backup:
xtrabackup --backup --target-dir=/data/backups/
● Check that the last line ends with:
completed OK!
● Second last line contains numbers you need to note:
xtrabackup: Transaction log of lsn (26970807) to
(137343534) was copied.
Restoring a Full Backup
Make a copy of the backup!
Percona does not guarantee that it remains usable if preparation is interrupted.
(though, in my experience, it is likely that it is useful; so it’s still worth a try)
● Prepare the backup:
xtrabackup --prepare --target-dir=/data/backups/
● Again, the last line should be:
completed OK!
● Copy the files to the correct place:
xtrabackup --copy-back --target-dir=/data/backups/
Taking Incremental Backups
● Take a full backup:
xtrabackup --backup --target-dir=/data/backups/full
● Take an incremental backup:
xtrabackup --backup --target-dir=/data/backups/inc1 
--incremental-basedir=/data/backups/full
● Each directory contains a file called xtrabackup_checkpoints
Restoring Incremental Backups
● Prepare the full backup:
xtrabackup --prepare --apply-log-only 
--target-dir=/data/backups/full
● Prepare incremental backups (update the full backup):
● xtrabackup --prepare --apply-log-only 
--target-dir=/data/backups/full 
--incremental-dir=/data/backups/inc1
● Restore the full backup:
xtrabackup --copy-back --target-dir=/data/backups/
Make a copy of all backups before preparation!
A preparation failure could ruin the full backup.
Also, an incremental backup cannot be prepared twice.
Other Features
● Compressed backups
● Stream backup to another server
● Choose databases / tables to backup
Performance
● Always make it use a reasonable amount of memory:
--use-memory=8G
● Use enough threads:
--threads=4
● If I/O could be saturated:
--throttle=1
Binary Log (binlog)
The Binary Log
● The Binary Log contains all changes to data
● It is used for replication and incremental backups
The Binary Log
● Every change has coordinates
● When you make a full backup, you can record the coordinates of the last
change
● If you ever restore the backup, you can also re-apply the binlog after those
coordinates
mysqlbinlog --start-position=46183 
/mysql-bin.000039 | mysql
mysqlbinlog --start-position=46183 --database=db1 
/mysql-bin.000039 | mysql
Binlog Formats
● binlog_format determines how changes are logged
○ ROW: primary key / UNIQUE index + new values
■ binlog_row_image = MINIMAL
○ STATEMENT: original SQL statement
○ MIXED: use STATEMENT when it is safe to do so
Binlog Reliability
Other binlog settings to make the binlog reliable:
● binlog_checksum = CRC32
● sync_binlog = 1
Testing Backups
To Test or Not To Test
Poll on my website: Do you test your backups?
● 25% No
● 60% I don’t see why
Why to Test?
● Something may go wrong and the backups may be unusable
● Restore procedure may become wrong at some point
● The person who restores the backup may not know how to do it
Can something really go wrong???
● Google for "GitLab.com database incident", happened in 2017
● 3 backups strategies in place
● 0 usable backups
● They recovered data up to 6 hours before, because someone took a backup
manually for some random reason
Can something really go wrong???
● Think about Percona Xtrabackup problem
● You update MySQL, you don’t test your backups, they simply stop working
● You will find out when you need them
Can something really go wrong???
● Disk full
● Versions mismatch after an update
● Network outage
● ...
How to test?
● Have multiple backup strategies
○ Tests are not perfect
○ Even if test tells you your backup failed, you need to have another
working backup
● Automate your backups
● Automate tests
How to test?
● A good test would be to use backups to feed staging databases, nightly
● Different sets of staging DBs can be fed by different backup types
● The script that restores backups in staging can be used to restore them
in production
What to test?
Early tests - if a backup obviously failed, you may know it immediately
● Exit status
● Backup exists
● Backup size reasonable (not 1 byte…)
● Time took by backup procedure (not too short, not too long)
What to test?
Late tests - if the backup procedure apparently succeeded, let’s make more tests
● Restore backup automatically
● Number of tables looks right
● Number of columns looks right
○ If migrations may happen during the night, a small difference must not
trigger an alert
● information_schema tables can be queried and don’t generate
errors/warnings
● Regular tables can be queried
● Check a small sample of rows that are not expected to change
○ It’s easy for read-only and append-only tables
Thank you for listening!
federico-razzoli.com/services
Telegram channel:
open_source_databases

More Related Content

What's hot

Inno db datafiles backup and retore
Inno db datafiles backup and retoreInno db datafiles backup and retore
Inno db datafiles backup and retoreVasudeva Rao
 
Highload Perf Tuning
Highload Perf TuningHighload Perf Tuning
Highload Perf TuningHighLoad2009
 
DB2UDB_the_Basics Day 4
DB2UDB_the_Basics Day 4DB2UDB_the_Basics Day 4
DB2UDB_the_Basics Day 4Pranav Prakash
 
MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)
MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)
MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)Valeriy Kravchuk
 
Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...
Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...
Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...Valeriy Kravchuk
 
Percona xtra db cluster(pxc) non blocking operations, what you need to know t...
Percona xtra db cluster(pxc) non blocking operations, what you need to know t...Percona xtra db cluster(pxc) non blocking operations, what you need to know t...
Percona xtra db cluster(pxc) non blocking operations, what you need to know t...Marco Tusa
 
Performance schema in_my_sql_5.6_pluk2013
Performance schema in_my_sql_5.6_pluk2013Performance schema in_my_sql_5.6_pluk2013
Performance schema in_my_sql_5.6_pluk2013Valeriy Kravchuk
 
Plmce 14 be a_hero_16x9_final
Plmce 14 be a_hero_16x9_finalPlmce 14 be a_hero_16x9_final
Plmce 14 be a_hero_16x9_finalMarco Tusa
 
Percona xtrabackup - MySQL Meetup @ Mumbai
Percona xtrabackup - MySQL Meetup @ MumbaiPercona xtrabackup - MySQL Meetup @ Mumbai
Percona xtrabackup - MySQL Meetup @ MumbaiNilnandan Joshi
 
Preparse Query Rewrite Plugins
Preparse Query Rewrite PluginsPreparse Query Rewrite Plugins
Preparse Query Rewrite PluginsSveta Smirnova
 
MySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxMySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxNeoClova
 
Mysql database basic user guide
Mysql database basic user guideMysql database basic user guide
Mysql database basic user guidePoguttuezhiniVP
 
DB2UDB_the_Basics Day 5
DB2UDB_the_Basics Day 5DB2UDB_the_Basics Day 5
DB2UDB_the_Basics Day 5Pranav Prakash
 
All types of backups and restore
All types of backups and restoreAll types of backups and restore
All types of backups and restoreVasudeva Rao
 
data loading and unloading in IBM Netezza by www.etraining.guru
data loading and unloading in IBM Netezza by www.etraining.gurudata loading and unloading in IBM Netezza by www.etraining.guru
data loading and unloading in IBM Netezza by www.etraining.guruRavikumar Nandigam
 
MySQL database replication
MySQL database replicationMySQL database replication
MySQL database replicationPoguttuezhiniVP
 
MySQL Performance schema missing_manual_flossuk
MySQL Performance schema missing_manual_flossukMySQL Performance schema missing_manual_flossuk
MySQL Performance schema missing_manual_flossukValeriy Kravchuk
 
Online MySQL Backups with Percona XtraBackup
Online MySQL Backups with Percona XtraBackupOnline MySQL Backups with Percona XtraBackup
Online MySQL Backups with Percona XtraBackupKenny Gryp
 
Performance Schema for MySQL troubleshooting
Performance Schema for MySQL troubleshootingPerformance Schema for MySQL troubleshooting
Performance Schema for MySQL troubleshootingSveta Smirnova
 
Evolution of MySQL Parallel Replication
Evolution of MySQL Parallel Replication Evolution of MySQL Parallel Replication
Evolution of MySQL Parallel Replication Mydbops
 

What's hot (20)

Inno db datafiles backup and retore
Inno db datafiles backup and retoreInno db datafiles backup and retore
Inno db datafiles backup and retore
 
Highload Perf Tuning
Highload Perf TuningHighload Perf Tuning
Highload Perf Tuning
 
DB2UDB_the_Basics Day 4
DB2UDB_the_Basics Day 4DB2UDB_the_Basics Day 4
DB2UDB_the_Basics Day 4
 
MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)
MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)
MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)
 
Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...
Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...
Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...
 
Percona xtra db cluster(pxc) non blocking operations, what you need to know t...
Percona xtra db cluster(pxc) non blocking operations, what you need to know t...Percona xtra db cluster(pxc) non blocking operations, what you need to know t...
Percona xtra db cluster(pxc) non blocking operations, what you need to know t...
 
Performance schema in_my_sql_5.6_pluk2013
Performance schema in_my_sql_5.6_pluk2013Performance schema in_my_sql_5.6_pluk2013
Performance schema in_my_sql_5.6_pluk2013
 
Plmce 14 be a_hero_16x9_final
Plmce 14 be a_hero_16x9_finalPlmce 14 be a_hero_16x9_final
Plmce 14 be a_hero_16x9_final
 
Percona xtrabackup - MySQL Meetup @ Mumbai
Percona xtrabackup - MySQL Meetup @ MumbaiPercona xtrabackup - MySQL Meetup @ Mumbai
Percona xtrabackup - MySQL Meetup @ Mumbai
 
Preparse Query Rewrite Plugins
Preparse Query Rewrite PluginsPreparse Query Rewrite Plugins
Preparse Query Rewrite Plugins
 
MySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxMySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptx
 
Mysql database basic user guide
Mysql database basic user guideMysql database basic user guide
Mysql database basic user guide
 
DB2UDB_the_Basics Day 5
DB2UDB_the_Basics Day 5DB2UDB_the_Basics Day 5
DB2UDB_the_Basics Day 5
 
All types of backups and restore
All types of backups and restoreAll types of backups and restore
All types of backups and restore
 
data loading and unloading in IBM Netezza by www.etraining.guru
data loading and unloading in IBM Netezza by www.etraining.gurudata loading and unloading in IBM Netezza by www.etraining.guru
data loading and unloading in IBM Netezza by www.etraining.guru
 
MySQL database replication
MySQL database replicationMySQL database replication
MySQL database replication
 
MySQL Performance schema missing_manual_flossuk
MySQL Performance schema missing_manual_flossukMySQL Performance schema missing_manual_flossuk
MySQL Performance schema missing_manual_flossuk
 
Online MySQL Backups with Percona XtraBackup
Online MySQL Backups with Percona XtraBackupOnline MySQL Backups with Percona XtraBackup
Online MySQL Backups with Percona XtraBackup
 
Performance Schema for MySQL troubleshooting
Performance Schema for MySQL troubleshootingPerformance Schema for MySQL troubleshooting
Performance Schema for MySQL troubleshooting
 
Evolution of MySQL Parallel Replication
Evolution of MySQL Parallel Replication Evolution of MySQL Parallel Replication
Evolution of MySQL Parallel Replication
 

Similar to MySQL and MariaDB Backups

Zararfa SummerCamp 2012 - Performing fast backups in large scale environments...
Zararfa SummerCamp 2012 - Performing fast backups in large scale environments...Zararfa SummerCamp 2012 - Performing fast backups in large scale environments...
Zararfa SummerCamp 2012 - Performing fast backups in large scale environments...Zarafa
 
Mongo nyc nyt + mongodb
Mongo nyc nyt + mongodbMongo nyc nyt + mongodb
Mongo nyc nyt + mongodbDeep Kapadia
 
Backing up Wikipedia Databases
Backing up Wikipedia DatabasesBacking up Wikipedia Databases
Backing up Wikipedia DatabasesJaime Crespo
 
Scaling up and accelerating Drupal 8 with NoSQL
Scaling up and accelerating Drupal 8 with NoSQLScaling up and accelerating Drupal 8 with NoSQL
Scaling up and accelerating Drupal 8 with NoSQLOSInet
 
The Proper Care and Feeding of MySQL Databases
The Proper Care and Feeding of MySQL DatabasesThe Proper Care and Feeding of MySQL Databases
The Proper Care and Feeding of MySQL DatabasesDave Stokes
 
MariaDB / MySQL tripping hazard and how to get out again?
MariaDB / MySQL tripping hazard and how to get out again?MariaDB / MySQL tripping hazard and how to get out again?
MariaDB / MySQL tripping hazard and how to get out again?FromDual GmbH
 
Percona Xtrabackup - Highly Efficient Backups
Percona Xtrabackup - Highly Efficient BackupsPercona Xtrabackup - Highly Efficient Backups
Percona Xtrabackup - Highly Efficient BackupsMydbops
 
PL22 - Backup and Restore Performance.pptx
PL22 - Backup and Restore Performance.pptxPL22 - Backup and Restore Performance.pptx
PL22 - Backup and Restore Performance.pptxVinicius M Grippa
 
Percona XtraBackup - New Features and Improvements
Percona XtraBackup - New Features and ImprovementsPercona XtraBackup - New Features and Improvements
Percona XtraBackup - New Features and ImprovementsMarcelo Altmann
 
Webinar - Key Reasons to Upgrade to MySQL 8.0 or MariaDB 10.11
Webinar - Key Reasons to Upgrade to MySQL 8.0 or MariaDB 10.11Webinar - Key Reasons to Upgrade to MySQL 8.0 or MariaDB 10.11
Webinar - Key Reasons to Upgrade to MySQL 8.0 or MariaDB 10.11Federico Razzoli
 
Linux Memory Basics for SysAdmins - ChinaNetCloud Training
Linux Memory Basics for SysAdmins - ChinaNetCloud TrainingLinux Memory Basics for SysAdmins - ChinaNetCloud Training
Linux Memory Basics for SysAdmins - ChinaNetCloud TrainingChinaNetCloud
 
Proper Care and Feeding of a MySQL Database for Busy Linux Administrators
Proper Care and Feeding of a MySQL Database for Busy Linux AdministratorsProper Care and Feeding of a MySQL Database for Busy Linux Administrators
Proper Care and Feeding of a MySQL Database for Busy Linux AdministratorsDave Stokes
 
Mysqlhacodebits20091203 1260184765-phpapp02
Mysqlhacodebits20091203 1260184765-phpapp02Mysqlhacodebits20091203 1260184765-phpapp02
Mysqlhacodebits20091203 1260184765-phpapp02Louis liu
 
MySQL High Availability Solutions
MySQL High Availability SolutionsMySQL High Availability Solutions
MySQL High Availability SolutionsLenz Grimmer
 
MySQL High Availability Solutions
MySQL High Availability SolutionsMySQL High Availability Solutions
MySQL High Availability SolutionsLenz Grimmer
 
Nagios Conference 2014 - Andy Brist - Nagios XI Failover and HA Solutions
Nagios Conference 2014 - Andy Brist - Nagios XI Failover and HA SolutionsNagios Conference 2014 - Andy Brist - Nagios XI Failover and HA Solutions
Nagios Conference 2014 - Andy Brist - Nagios XI Failover and HA SolutionsNagios
 
The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...
The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...
The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...Dave Stokes
 
MySQL always-up with Galera Cluster
MySQL always-up with Galera ClusterMySQL always-up with Galera Cluster
MySQL always-up with Galera ClusterFromDual GmbH
 
Upgrade to MySQL 5.6 without downtime
Upgrade to MySQL 5.6 without downtimeUpgrade to MySQL 5.6 without downtime
Upgrade to MySQL 5.6 without downtimeOlivier DASINI
 

Similar to MySQL and MariaDB Backups (20)

Zararfa SummerCamp 2012 - Performing fast backups in large scale environments...
Zararfa SummerCamp 2012 - Performing fast backups in large scale environments...Zararfa SummerCamp 2012 - Performing fast backups in large scale environments...
Zararfa SummerCamp 2012 - Performing fast backups in large scale environments...
 
Mongo nyc nyt + mongodb
Mongo nyc nyt + mongodbMongo nyc nyt + mongodb
Mongo nyc nyt + mongodb
 
Backing up Wikipedia Databases
Backing up Wikipedia DatabasesBacking up Wikipedia Databases
Backing up Wikipedia Databases
 
Scaling up and accelerating Drupal 8 with NoSQL
Scaling up and accelerating Drupal 8 with NoSQLScaling up and accelerating Drupal 8 with NoSQL
Scaling up and accelerating Drupal 8 with NoSQL
 
The Proper Care and Feeding of MySQL Databases
The Proper Care and Feeding of MySQL DatabasesThe Proper Care and Feeding of MySQL Databases
The Proper Care and Feeding of MySQL Databases
 
MariaDB / MySQL tripping hazard and how to get out again?
MariaDB / MySQL tripping hazard and how to get out again?MariaDB / MySQL tripping hazard and how to get out again?
MariaDB / MySQL tripping hazard and how to get out again?
 
Percona Xtrabackup - Highly Efficient Backups
Percona Xtrabackup - Highly Efficient BackupsPercona Xtrabackup - Highly Efficient Backups
Percona Xtrabackup - Highly Efficient Backups
 
PL22 - Backup and Restore Performance.pptx
PL22 - Backup and Restore Performance.pptxPL22 - Backup and Restore Performance.pptx
PL22 - Backup and Restore Performance.pptx
 
Percona XtraBackup - New Features and Improvements
Percona XtraBackup - New Features and ImprovementsPercona XtraBackup - New Features and Improvements
Percona XtraBackup - New Features and Improvements
 
Webinar - Key Reasons to Upgrade to MySQL 8.0 or MariaDB 10.11
Webinar - Key Reasons to Upgrade to MySQL 8.0 or MariaDB 10.11Webinar - Key Reasons to Upgrade to MySQL 8.0 or MariaDB 10.11
Webinar - Key Reasons to Upgrade to MySQL 8.0 or MariaDB 10.11
 
Linux Memory Basics for SysAdmins - ChinaNetCloud Training
Linux Memory Basics for SysAdmins - ChinaNetCloud TrainingLinux Memory Basics for SysAdmins - ChinaNetCloud Training
Linux Memory Basics for SysAdmins - ChinaNetCloud Training
 
Proper Care and Feeding of a MySQL Database for Busy Linux Administrators
Proper Care and Feeding of a MySQL Database for Busy Linux AdministratorsProper Care and Feeding of a MySQL Database for Busy Linux Administrators
Proper Care and Feeding of a MySQL Database for Busy Linux Administrators
 
Mysqlhacodebits20091203 1260184765-phpapp02
Mysqlhacodebits20091203 1260184765-phpapp02Mysqlhacodebits20091203 1260184765-phpapp02
Mysqlhacodebits20091203 1260184765-phpapp02
 
MySQL High Availability Solutions
MySQL High Availability SolutionsMySQL High Availability Solutions
MySQL High Availability Solutions
 
MySQL High Availability Solutions
MySQL High Availability SolutionsMySQL High Availability Solutions
MySQL High Availability Solutions
 
Nagios Conference 2014 - Andy Brist - Nagios XI Failover and HA Solutions
Nagios Conference 2014 - Andy Brist - Nagios XI Failover and HA SolutionsNagios Conference 2014 - Andy Brist - Nagios XI Failover and HA Solutions
Nagios Conference 2014 - Andy Brist - Nagios XI Failover and HA Solutions
 
The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...
The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...
The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...
 
MySQL always-up with Galera Cluster
MySQL always-up with Galera ClusterMySQL always-up with Galera Cluster
MySQL always-up with Galera Cluster
 
Upgrade to MySQL 5.6 without downtime
Upgrade to MySQL 5.6 without downtimeUpgrade to MySQL 5.6 without downtime
Upgrade to MySQL 5.6 without downtime
 
Running MySQL in AWS
Running MySQL in AWSRunning MySQL in AWS
Running MySQL in AWS
 

More from Federico Razzoli

Webinar - Unleash AI power with MySQL and MindsDB
Webinar - Unleash AI power with MySQL and MindsDBWebinar - Unleash AI power with MySQL and MindsDB
Webinar - Unleash AI power with MySQL and MindsDBFederico Razzoli
 
MariaDB Security Best Practices
MariaDB Security Best PracticesMariaDB Security Best Practices
MariaDB Security Best PracticesFederico Razzoli
 
A first look at MariaDB 11.x features and ideas on how to use them
A first look at MariaDB 11.x features and ideas on how to use themA first look at MariaDB 11.x features and ideas on how to use them
A first look at MariaDB 11.x features and ideas on how to use themFederico Razzoli
 
MariaDB stored procedures and why they should be improved
MariaDB stored procedures and why they should be improvedMariaDB stored procedures and why they should be improved
MariaDB stored procedures and why they should be improvedFederico Razzoli
 
Webinar - MariaDB Temporal Tables: a demonstration
Webinar - MariaDB Temporal Tables: a demonstrationWebinar - MariaDB Temporal Tables: a demonstration
Webinar - MariaDB Temporal Tables: a demonstrationFederico Razzoli
 
MariaDB 10.11 key features overview for DBAs
MariaDB 10.11 key features overview for DBAsMariaDB 10.11 key features overview for DBAs
MariaDB 10.11 key features overview for DBAsFederico Razzoli
 
Recent MariaDB features to learn for a happy life
Recent MariaDB features to learn for a happy lifeRecent MariaDB features to learn for a happy life
Recent MariaDB features to learn for a happy lifeFederico Razzoli
 
Advanced MariaDB features that developers love.pdf
Advanced MariaDB features that developers love.pdfAdvanced MariaDB features that developers love.pdf
Advanced MariaDB features that developers love.pdfFederico Razzoli
 
Automate MariaDB Galera clusters deployments with Ansible
Automate MariaDB Galera clusters deployments with AnsibleAutomate MariaDB Galera clusters deployments with Ansible
Automate MariaDB Galera clusters deployments with AnsibleFederico Razzoli
 
Creating Vagrant development machines with MariaDB
Creating Vagrant development machines with MariaDBCreating Vagrant development machines with MariaDB
Creating Vagrant development machines with MariaDBFederico Razzoli
 
MariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructuresMariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructuresFederico Razzoli
 
Database Design most common pitfalls
Database Design most common pitfallsDatabase Design most common pitfalls
Database Design most common pitfallsFederico Razzoli
 
JSON in MySQL and MariaDB Databases
JSON in MySQL and MariaDB DatabasesJSON in MySQL and MariaDB Databases
JSON in MySQL and MariaDB DatabasesFederico Razzoli
 
How MySQL can boost (or kill) your application v2
How MySQL can boost (or kill) your application v2How MySQL can boost (or kill) your application v2
How MySQL can boost (or kill) your application v2Federico Razzoli
 
MySQL Transaction Isolation Levels (lightning talk)
MySQL Transaction Isolation Levels (lightning talk)MySQL Transaction Isolation Levels (lightning talk)
MySQL Transaction Isolation Levels (lightning talk)Federico Razzoli
 
Cassandra sharding and consistency (lightning talk)
Cassandra sharding and consistency (lightning talk)Cassandra sharding and consistency (lightning talk)
Cassandra sharding and consistency (lightning talk)Federico Razzoli
 
MySQL Query Optimisation 101
MySQL Query Optimisation 101MySQL Query Optimisation 101
MySQL Query Optimisation 101Federico Razzoli
 
How MySQL can boost (or kill) your application
How MySQL can boost (or kill) your applicationHow MySQL can boost (or kill) your application
How MySQL can boost (or kill) your applicationFederico Razzoli
 

More from Federico Razzoli (19)

Webinar - Unleash AI power with MySQL and MindsDB
Webinar - Unleash AI power with MySQL and MindsDBWebinar - Unleash AI power with MySQL and MindsDB
Webinar - Unleash AI power with MySQL and MindsDB
 
MariaDB Security Best Practices
MariaDB Security Best PracticesMariaDB Security Best Practices
MariaDB Security Best Practices
 
A first look at MariaDB 11.x features and ideas on how to use them
A first look at MariaDB 11.x features and ideas on how to use themA first look at MariaDB 11.x features and ideas on how to use them
A first look at MariaDB 11.x features and ideas on how to use them
 
MariaDB stored procedures and why they should be improved
MariaDB stored procedures and why they should be improvedMariaDB stored procedures and why they should be improved
MariaDB stored procedures and why they should be improved
 
Webinar - MariaDB Temporal Tables: a demonstration
Webinar - MariaDB Temporal Tables: a demonstrationWebinar - MariaDB Temporal Tables: a demonstration
Webinar - MariaDB Temporal Tables: a demonstration
 
MariaDB 10.11 key features overview for DBAs
MariaDB 10.11 key features overview for DBAsMariaDB 10.11 key features overview for DBAs
MariaDB 10.11 key features overview for DBAs
 
Recent MariaDB features to learn for a happy life
Recent MariaDB features to learn for a happy lifeRecent MariaDB features to learn for a happy life
Recent MariaDB features to learn for a happy life
 
Advanced MariaDB features that developers love.pdf
Advanced MariaDB features that developers love.pdfAdvanced MariaDB features that developers love.pdf
Advanced MariaDB features that developers love.pdf
 
Automate MariaDB Galera clusters deployments with Ansible
Automate MariaDB Galera clusters deployments with AnsibleAutomate MariaDB Galera clusters deployments with Ansible
Automate MariaDB Galera clusters deployments with Ansible
 
Creating Vagrant development machines with MariaDB
Creating Vagrant development machines with MariaDBCreating Vagrant development machines with MariaDB
Creating Vagrant development machines with MariaDB
 
MariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructuresMariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructures
 
Database Design most common pitfalls
Database Design most common pitfallsDatabase Design most common pitfalls
Database Design most common pitfalls
 
JSON in MySQL and MariaDB Databases
JSON in MySQL and MariaDB DatabasesJSON in MySQL and MariaDB Databases
JSON in MySQL and MariaDB Databases
 
How MySQL can boost (or kill) your application v2
How MySQL can boost (or kill) your application v2How MySQL can boost (or kill) your application v2
How MySQL can boost (or kill) your application v2
 
MySQL Transaction Isolation Levels (lightning talk)
MySQL Transaction Isolation Levels (lightning talk)MySQL Transaction Isolation Levels (lightning talk)
MySQL Transaction Isolation Levels (lightning talk)
 
Cassandra sharding and consistency (lightning talk)
Cassandra sharding and consistency (lightning talk)Cassandra sharding and consistency (lightning talk)
Cassandra sharding and consistency (lightning talk)
 
MariaDB Temporal Tables
MariaDB Temporal TablesMariaDB Temporal Tables
MariaDB Temporal Tables
 
MySQL Query Optimisation 101
MySQL Query Optimisation 101MySQL Query Optimisation 101
MySQL Query Optimisation 101
 
How MySQL can boost (or kill) your application
How MySQL can boost (or kill) your applicationHow MySQL can boost (or kill) your application
How MySQL can boost (or kill) your application
 

Recently uploaded

Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfJamie (Taka) Wang
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"
UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"
UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"DianaGray10
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdfPedro Manuel
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Adtran
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
The Kubernetes Gateway API and its role in Cloud Native API Management
The Kubernetes Gateway API and its role in Cloud Native API ManagementThe Kubernetes Gateway API and its role in Cloud Native API Management
The Kubernetes Gateway API and its role in Cloud Native API ManagementNuwan Dias
 
Valere | Digital Solutions & AI Transformation Portfolio | 2024
Valere | Digital Solutions & AI Transformation Portfolio | 2024Valere | Digital Solutions & AI Transformation Portfolio | 2024
Valere | Digital Solutions & AI Transformation Portfolio | 2024Alexander Turgeon
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostMatt Ray
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 

Recently uploaded (20)

Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"
UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"
UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdf
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
The Kubernetes Gateway API and its role in Cloud Native API Management
The Kubernetes Gateway API and its role in Cloud Native API ManagementThe Kubernetes Gateway API and its role in Cloud Native API Management
The Kubernetes Gateway API and its role in Cloud Native API Management
 
Valere | Digital Solutions & AI Transformation Portfolio | 2024
Valere | Digital Solutions & AI Transformation Portfolio | 2024Valere | Digital Solutions & AI Transformation Portfolio | 2024
Valere | Digital Solutions & AI Transformation Portfolio | 2024
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 

MySQL and MariaDB Backups

  • 2. € whoami ● Federico Razzoli ● Freelance consultant ● Working with databases since 2000 hello@federico-razzoli.com federico-razzoli.com ● I worked as a consultant for Percona and Ibuildings (mainly MySQL and MariaDB) ● I worked as a DBA for fast-growing companies like Catawiki, HumanState, TransferWise
  • 3. Agenda ● We’ll talk about different MySQL/MariaDB backup types and their characteristics ● Not many details about each solution ● We’ll also talk about planning backup strategies and testing backups
  • 5. Before Planning... ● Evaluate costs ● Evaluate risks ● Define Backup strategies
  • 6. Costs ● Everything that increases your reliability: ○ Costs money. ○ Produces no money. ● Managers understand this very well and keep it in mind when you talk about backups
  • 7. Costs ● Disasters: ○ Cost money. ○ Produces no money. ● Reduce disaster probability ○ Avoiding them is impossible ● Limit the damage they make ○ Serious Backup Strategies ● Then what is the “right” amount of money to spend for backups?
  • 8. Data Loss Costs ● Cost to re-acquire data (if possible) ● Cost of services/products that cannot be sold ● Lifetime value of lost customers that are lost or not acquired ● Reputation cost, disappointed candidates…
  • 9. Downtime Costs is the cost of the time elapsed until a backup is restored and the services back to life ● Cost of unsold services/products ● Lifetime value of customers that won’t return ● Reputation cost, Google rank, disappointed candidates...
  • 10. Evaluate risks ● “If data is lost” is not a risk, it’s a generic concern ● Risks are, for example: ○ We drop a wrong table by mistake ○ Application deletes useful data because of a bug ○ A table gets corrupted during a write ○ Disk gets corrupted after a hardware failure ○ Cloud vendor is down ○ … ● Different risks are prevented in different ways
  • 11. Defining Backup Strategies ● For each strategy, decide: ○ How the backup is taken ○ How often ○ Where the backup is stored ○ For how much time ○ How much time the backup can take ○ How much space the backup can take ○ How much time the restore can take ● You can easily see how some of these questions are inter-dependent ● You can have multiple backup levels: ○ Latest backup stored locally, uncompressed ○ 7 Daily backups in S3
  • 13. Cold vs Hot ● Cold: stop MySQL and copy data ○ Downtime ○ Faster ● Hot: take backups while MySQL is running ○ Slow down ○ More complex
  • 14. Physical vs Logical ● Physical: Set of files and directory ○ Usually takes more space (indexes are included) ○ Doing it while the server is running requires tools ● Logical: SQL statements to recreate a dataset ○ Can only be Hot ○ Can potentially be restored on any MySQL/MariaDB version ■ ...and even different SQL databases ○ Takes more time to take backup and to restore it ○ Inconsistent OR long transaction
  • 15. Complete vs Partial ● Complete: All data ● Partial: A selected part of data ○ One or more databases ○ One or more tables from a database ○ Result of a SELECT (only Logical backup)
  • 16. Full vs Incremental ● Full: A backup of data at a certain point in time ○ A Full backup can take a long time ○ Suppose you take it every 24 hours. In case of disaster, you could lose up to 24 hours of changes ● Incremental ○ Taking an incremental backup normally takes much less time ○ It includes the changes that happened after the last full backup ○ If there is a hole between the full backup and the oldest changes we have, our incremental backups are useless
  • 18. Galera and Group Replication ● Often it makes sense to leave one node unused, and leave it available for failover ● Backups can be taken from this node
  • 19. Async Slaves ● It is a common practice to take backups from slaves ● But remember that slaves can lag ● If a slave is unused, it can be stopped to take cold backups ● MySQL and MariaDB support delayed replication ● Useful in case of human mistakes
  • 21. mysqldump mysqldump [options] > dump.sql mysql < dump.sql ● The dump file contains CREATE and INSERT statements ● Part of the syntax is enclosed in executable statements: /*!080000 ... */ /*M!100400 ... */
  • 22. mysqldump ● Monothread - slow! ● CREATE TABLEs include indexes - restore is slow! ● Many options to include/exclude tables/databases ● --where ● --no-data ● --triggers, --routines, --events ● Inconsistent by default. Use --single-transaction ○ MariaDB uses savepoints to unlock backuped rows ● For big tables use --quick
  • 23. mysqlpump ● Comes with MySQL 5.7+, not in MariaDB ● Very similar to mysqldump ● Multi-thread, produces multiple files reloadable as normal dumps ● Option to compress the resulted files (cannot mysqlpump | gzip) ● Indexes are created after INSERT ● Users are dumped as CREATE USER
  • 24. mydumper, myloader ● Multiple files per table: --threads 4 --rows 100000 How it works: ● Master thread connects MySQL/MariaDB and runs FLUSH TABLES WITH READ LOCK; ● Worker threads connect and run START TRANSACTION WITH CONSISTENT SNAPSHOT; ● Master thread: UNLOCK TABLES; ● Worker threads copy all data
  • 25. mydumper, myloader Other important options: ● --no-data ● --triggers, --routines, --events ● --compress ● --trx-consistency-only if you only dump InnoDB tables ● Use myloader to restore ○ --thread 4
  • 26. Non-Transactional Tables ● (MyISAM, Aria, ARCHIVE…) ● To get a consistent dump, tables must be locked with LOCK TABLES
  • 27. Temporal Tables ● MariaDB feature to track how data change over time ● Temporal tables have timestamp columns that define when a row version validity started and when it ended ● If we create those columns explicitly, they are visible ● If those columns are visible and included in the dumps, dumps cannot be restored ● Otherwise, the original timestamps will be lost
  • 28. SHOW CREATE ● To get more flexibility, you can also write a script that uses SHOW CREATE statements ● They return the CREATE statements to create an identical object (without data) ● SHOW DATABASES; SHOW CREATE DATABASE; ● SHOW TABLES; SHOW CREATE TABLE; ● SHOW VIEWS; SHOW CREATE VIEW; ● SHOW TRIGGERS; SHOW CREATE TRIGGER; ● ...
  • 30. Cold Backups ● Copy the files to somewhere else ● This includes configuration files, etc ● MySQL must not be running ○ OR, you can make sure it is not writing to files: ○ STOP SLAVE; ○ FLUSH TABLES WITH READ LOCK; ○ Copy ○ UNLOCK TABLES; ○ START SLAVE; ● The copy can be done incrementally, by using rsync
  • 31. Snapshots ● Snapshots are not a MySQL/MariaDB feature ● They can be implemented in an underlying technology: volume manager (lvm), filesystem (zfs), Virtual Machine, Container ○ Your cloud provider most probably provides snapshots ○ but check documentation ● Existing files are frozen. They are the snapshots ● Everything written to disk afterwards is written separately (CoW), leaving the current files intact ● Snapshots can be incremental - only contains changes since the previous snapshot ● Snapshots can be sent to other servers ● Windows has Shadow Copies
  • 32. Restoring Snapshots ● When mysqld or the filesystem suddenly crashes, it leaves inconsistent files ○ InnoDB tables (depending on configuration) don’t lose data, but tables must be repaired on restart using the information stored in redo log and undo log ○ MyISAM tables lose changes not flushed at the time of the crash ● When you take a snapshot it’s the same: you take a frozen copy of inconsistent files (if mysqld was running) ● Restoring a backup implies that when mysqld is restarted tables will be repaired
  • 34. Transportable Tablespaces ● Works for InnoDB tables contained in a dedicated file ● Allows to copy a table from another server that runs the same MySQL version Source server: ● Run: FLUSH TABLES my_table FOR EXPORT; ● Copy the table file (.ibd) or take a snapshot Target server: ● Run: ALTER TABLE my_table DISCARD TABLESPACE; ● Copy the table ● Run: ALTER TABLE my_table IMPORT TABLESPACE;
  • 36. xtrabackup ● xtrabackup is a tool to copy files while the server is running, without locking InnoDB tables ● Produced by Percona ● Focus on MySQL ● Only works on Linux
  • 37. xtrabackup ● xtrabackup is a tool to copy files while the server is running, without locking InnoDB tables ● Produced by Percona ● Focus on MySQL, no support for MariaDB where it is incompatible with MySQL ● Only works on Linux, no Windows support
  • 38. mariabackup ● Introduced in MariaDB 10.1 ● Fork of Xtrabackup 2.3 ● Supports all MariaDB features ● Run on both Linux and Windows
  • 39. Xtrabackup 8 ● MySQL 8.0.20 (April 2020) introduced a Redo Log format change (despite being a GA version) ● This break Xtrabackup compatibility ● Percona is working on a new release that understands the new Redo Log PXB-2167 - Pending Release You can subscribe to the issue
  • 40. Taking a Full Backup ● Take a full backup: xtrabackup --backup --target-dir=/data/backups/ ● Check that the last line ends with: completed OK! ● Second last line contains numbers you need to note: xtrabackup: Transaction log of lsn (26970807) to (137343534) was copied.
  • 41. Restoring a Full Backup Make a copy of the backup! Percona does not guarantee that it remains usable if preparation is interrupted. (though, in my experience, it is likely that it is useful; so it’s still worth a try) ● Prepare the backup: xtrabackup --prepare --target-dir=/data/backups/ ● Again, the last line should be: completed OK! ● Copy the files to the correct place: xtrabackup --copy-back --target-dir=/data/backups/
  • 42. Taking Incremental Backups ● Take a full backup: xtrabackup --backup --target-dir=/data/backups/full ● Take an incremental backup: xtrabackup --backup --target-dir=/data/backups/inc1 --incremental-basedir=/data/backups/full ● Each directory contains a file called xtrabackup_checkpoints
  • 43. Restoring Incremental Backups ● Prepare the full backup: xtrabackup --prepare --apply-log-only --target-dir=/data/backups/full ● Prepare incremental backups (update the full backup): ● xtrabackup --prepare --apply-log-only --target-dir=/data/backups/full --incremental-dir=/data/backups/inc1 ● Restore the full backup: xtrabackup --copy-back --target-dir=/data/backups/ Make a copy of all backups before preparation! A preparation failure could ruin the full backup. Also, an incremental backup cannot be prepared twice.
  • 44. Other Features ● Compressed backups ● Stream backup to another server ● Choose databases / tables to backup
  • 45. Performance ● Always make it use a reasonable amount of memory: --use-memory=8G ● Use enough threads: --threads=4 ● If I/O could be saturated: --throttle=1
  • 47. The Binary Log ● The Binary Log contains all changes to data ● It is used for replication and incremental backups
  • 48. The Binary Log ● Every change has coordinates ● When you make a full backup, you can record the coordinates of the last change ● If you ever restore the backup, you can also re-apply the binlog after those coordinates mysqlbinlog --start-position=46183 /mysql-bin.000039 | mysql mysqlbinlog --start-position=46183 --database=db1 /mysql-bin.000039 | mysql
  • 49. Binlog Formats ● binlog_format determines how changes are logged ○ ROW: primary key / UNIQUE index + new values ■ binlog_row_image = MINIMAL ○ STATEMENT: original SQL statement ○ MIXED: use STATEMENT when it is safe to do so
  • 50. Binlog Reliability Other binlog settings to make the binlog reliable: ● binlog_checksum = CRC32 ● sync_binlog = 1
  • 52. To Test or Not To Test Poll on my website: Do you test your backups? ● 25% No ● 60% I don’t see why
  • 53. Why to Test? ● Something may go wrong and the backups may be unusable ● Restore procedure may become wrong at some point ● The person who restores the backup may not know how to do it
  • 54. Can something really go wrong??? ● Google for "GitLab.com database incident", happened in 2017 ● 3 backups strategies in place ● 0 usable backups ● They recovered data up to 6 hours before, because someone took a backup manually for some random reason
  • 55. Can something really go wrong??? ● Think about Percona Xtrabackup problem ● You update MySQL, you don’t test your backups, they simply stop working ● You will find out when you need them
  • 56. Can something really go wrong??? ● Disk full ● Versions mismatch after an update ● Network outage ● ...
  • 57. How to test? ● Have multiple backup strategies ○ Tests are not perfect ○ Even if test tells you your backup failed, you need to have another working backup ● Automate your backups ● Automate tests
  • 58. How to test? ● A good test would be to use backups to feed staging databases, nightly ● Different sets of staging DBs can be fed by different backup types ● The script that restores backups in staging can be used to restore them in production
  • 59. What to test? Early tests - if a backup obviously failed, you may know it immediately ● Exit status ● Backup exists ● Backup size reasonable (not 1 byte…) ● Time took by backup procedure (not too short, not too long)
  • 60. What to test? Late tests - if the backup procedure apparently succeeded, let’s make more tests ● Restore backup automatically ● Number of tables looks right ● Number of columns looks right ○ If migrations may happen during the night, a small difference must not trigger an alert ● information_schema tables can be queried and don’t generate errors/warnings ● Regular tables can be queried ● Check a small sample of rows that are not expected to change ○ It’s easy for read-only and append-only tables
  • 61. Thank you for listening! federico-razzoli.com/services Telegram channel: open_source_databases