SlideShare a Scribd company logo
1 of 16
Download to read offline
XtraBackup: Hot Backups
and More
Vadim Tkachenko
Morgan Tocker
http://percona.com
http://MySQLPerformanceBlog.com
MySQL CE
Apr 2010
Introduction
• Vadim Tkachenko
– Percona Inc, CTO and Lead of Development
• Morgan Tocker
– Percona Inc, Director of Training
XtraBackup: Hot Backups and More
-2-
Comparing Backup Options
Engine
s
Warmth Flex
Backup
Flex
Restore
Backup
time
Restore
time
Binlog
coord
Impact
mysqldump InnoDB/X
traDB
HOT ROW MOST MED WORST YES MEDIUM
mysqldump ALL WARM ROW MOST MED WORST YES MEDIUM
Snapshot ALL MOSTLY
HOT
SYSTEM SYSTEM SLOW-
MED
BEST YES HEAVY
XtraBackup InnoDB/X
traDB
HOT TABLE TABLE FAST BEST YES LOW
InnoDB Hot
Backup
InnoDB HOT TABLE TABLE FAST BEST YES LOW
XtraBackup /
InnoDB Hot
Backup
ALL WARM TABLE TABLE FAST BEST YES MEDIUM/
LARGE
MySQLHotC
opy
MyISAM WARM TABLE TABLE FAST BEST YES LOW
Cold Backup ALL COLD SYSTEM SYSTEM BEST BEST YES VERY
HEAVY
XtraBackup: Hot Backups and More
-3-
What is talk about
• XtraBackup
• Internals
• Basic and advance usage
XtraBackup: Hot Backups and More
-4-
Idea
• Copy XtraDB / InnoDB tables without stopping server ( and
locking tables)
• Challenge: Tables are being changed in background
• Alternative solutions
– ZFS snapshot ( Solaris / FreeBSD)
– LVM, good if performance is not concern
• 160 ios -> 25 ios
• ~20% space reservation
– InnoDB Hot Backup / Oracle Online Backup
• Commercial, per-server, last release 2006 ?
• Can be expensive for X,000 servers
XtraBackup: Hot Backups and More
-5-
Solution
• Copy tables and log changes
– InnoDB transactional redo logs are doing the same
– XtraBackup is mini instance of XtraDB / InnoDB
– Idea taken from InnoDB Hot Backup
XtraBackup: Hot Backups and More
-6-
Basic design
• Copy tables, log changes into xtrabackup_logfile
• Prepare – apply log to copied tables
XtraBackup: Hot Backups and More
-7-
copy
xtrabackup_logfile
tables
New location
changes
XtraBackup
• Non-blocking online backup of XtraDB / InnoDB /
InnoDB–plugin tables
• Blocking for MyISAM
XtraBackup: Hot Backups and More
-8-
Tools
• Binaries
– xtrabackup
• Copy .ibd & xtrabackup_logfile
– tar4ibd
• Script
– innobackupex-1.5.1
• Taken from InnoDB Hot Backup (GPL) , heavily modified
• Copy .frm, myisam, locking etc
XtraBackup: Hot Backups and More
-9-
Basic usage
• innobackupex-1.5.1 /destination/dir
• innobackupex-1.5.1 --apply-log /backup/dir
– --use-memory (1GB defaults)
• innobackupex-1.5.1 --throttle=IOS /destination/dir
XtraBackup: Hot Backups and More
-10-
Stream
• innobackupex-1.5.1 --stream=tar ./ > backup.tar
• Tar compatible stream ( -i required to extract)
– Tar was replaced by libtar and tar4ibd
• Compress
– innobackupex-1.5.1 --stream=tar ./ | gzip - > backup.tar.gz
• Copy to remote host
– innobackupex-1.5.1 --stream=tar ./ | ssh vadim@desthost "cat - >
/data/vol1/mysqluc/backup.tar“
• The same but with throttling
– innobackupex --stream=tar | pv -q -L10m | ssh vadim@desthost "tar xfi -"
XtraBackup: Hot Backups and More
-11-
Slave
• To setup slave from master
– No specific actions needed
• File xtrabackup_binlog_info
mysql-bin.000020 70206554
• To backup from slave
– innobackupex-1.5.1 --slave-info /destination/dir
• LOCK caveats
– FLUSH TABLES WITH READ LOCK to get master/slave
info and to copy MYISAM tables
– 100GB of MyISAM tables will cause a problem
XtraBackup: Hot Backups and More
-12-
Incremental/Differential
• We are able to copy only changes from last backup
– xtrabackup --backup --target-dir=/data/backups/incremental --incremental-
basedir=/data/backups/2010-04-11_17-55-54
• From output:
– … xtrabackup: The latest check point (for incremental): '2438774348‘ …
• xtrabackup --prepare --target-dir=/data/vadim/mysqluc/2010-04-11_20-45-42 --incremental-
dir=/data/vadim/mysqluc/incremental
XtraBackup: Hot Backups and More
-13-
Copy only
changes since
LSN
xtrabackup_logfile
tables
New location
changes
Export/import
• Export only table to another server
– xtrabackup --table=tpcc.order_line --backup --target-
dir=/data/vadim/mysqluc/order_line/
• Prepare
– xtrabackup --prepare --export --target-
dir=/data/vadim/mysqluc/order_line/
• Copy to remote host (it has to be XtraDB)
– alter table order_line discard tablespace;
– set global innodb_expand_import=1;
– alter table order_line import tablespace;
XtraBackup: Hot Backups and More
-14-
Statistics
• Show details on tablespaces / indexes
table: tpcc/order_line, index: PRIMARY, space id: 25, root page: 3, zip size: 0
estimated statistics in dictionary:
key vals: 32471816, leaf pages: 264267, size pages: 302592
real statistics:
level 2 pages: pages=1, data=8406 bytes, data/pages=51%
level 1 pages: pages=467, data=4756806 bytes, data/pages=62%
leaf pages: recs=35116662, pages=264267, data=2410713870 bytes, data/pages=55%
XtraBackup: Hot Backups and More
-15-
Thank you!
• Questions?
• vadim@percona.com
• morgan@percona.com
XtraBackup: Hot Backups and More
-16-

More Related Content

What's hot

MYSQLDUMP & ZRM COMMUNITY (EN)
MYSQLDUMP & ZRM COMMUNITY (EN)MYSQLDUMP & ZRM COMMUNITY (EN)
MYSQLDUMP & ZRM COMMUNITY (EN)Cédric P
 
Fast Incremental Backups with Percona Server and Percona XtraBackup / PLMCE 2014
Fast Incremental Backups with Percona Server and Percona XtraBackup / PLMCE 2014Fast Incremental Backups with Percona Server and Percona XtraBackup / PLMCE 2014
Fast Incremental Backups with Percona Server and Percona XtraBackup / PLMCE 2014Laurynas Biveinis
 
Linux internals for Database administrators at Linux Piter 2016
Linux internals for Database administrators at Linux Piter 2016Linux internals for Database administrators at Linux Piter 2016
Linux internals for Database administrators at Linux Piter 2016PostgreSQL-Consulting
 
All types of backups and restore
All types of backups and restoreAll types of backups and restore
All types of backups and restoreVasudeva Rao
 
Firebird Scalability, by Dmitry Yemanov (in English)
Firebird Scalability, by Dmitry Yemanov (in English)Firebird Scalability, by Dmitry Yemanov (in English)
Firebird Scalability, by Dmitry Yemanov (in English)Alexey Kovyazin
 
MongoDB 101 & Beyond: Get Started in MongoDB 3.0, Preview 3.2 & Demo of Ops M...
MongoDB 101 & Beyond: Get Started in MongoDB 3.0, Preview 3.2 & Demo of Ops M...MongoDB 101 & Beyond: Get Started in MongoDB 3.0, Preview 3.2 & Demo of Ops M...
MongoDB 101 & Beyond: Get Started in MongoDB 3.0, Preview 3.2 & Demo of Ops M...MongoDB
 
MySQL Backup and Security Best Practices
MySQL Backup and Security Best PracticesMySQL Backup and Security Best Practices
MySQL Backup and Security Best PracticesLenz Grimmer
 
深入了解Redis
深入了解Redis深入了解Redis
深入了解Redisiammutex
 
Inno db datafiles backup and retore
Inno db datafiles backup and retoreInno db datafiles backup and retore
Inno db datafiles backup and retoreVasudeva Rao
 
Exadata下的数据并行加载、并行卸载及性能监控
Exadata下的数据并行加载、并行卸载及性能监控Exadata下的数据并行加载、并行卸载及性能监控
Exadata下的数据并行加载、并行卸载及性能监控Kaiyao Huang
 
Backup, Restore, and Disaster Recovery
Backup, Restore, and Disaster RecoveryBackup, Restore, and Disaster Recovery
Backup, Restore, and Disaster RecoveryMongoDB
 
Percona live linux filesystems and my sql
Percona live   linux filesystems and my sqlPercona live   linux filesystems and my sql
Percona live linux filesystems and my sqlMichael Zhang
 
TokuDB internals / Лесин Владислав (Percona)
TokuDB internals / Лесин Владислав (Percona)TokuDB internals / Лесин Владислав (Percona)
TokuDB internals / Лесин Владислав (Percona)Ontico
 
Optimizing columnar stores
Optimizing columnar storesOptimizing columnar stores
Optimizing columnar storesIstvan Szukacs
 
Exploiting Your File System to Build Robust & Efficient Workflows
Exploiting Your File System to Build Robust & Efficient WorkflowsExploiting Your File System to Build Robust & Efficient Workflows
Exploiting Your File System to Build Robust & Efficient Workflowsjasonajohnson
 
DB2UDB_the_Basics Day 4
DB2UDB_the_Basics Day 4DB2UDB_the_Basics Day 4
DB2UDB_the_Basics Day 4Pranav Prakash
 

What's hot (18)

MYSQLDUMP & ZRM COMMUNITY (EN)
MYSQLDUMP & ZRM COMMUNITY (EN)MYSQLDUMP & ZRM COMMUNITY (EN)
MYSQLDUMP & ZRM COMMUNITY (EN)
 
Fast Incremental Backups with Percona Server and Percona XtraBackup / PLMCE 2014
Fast Incremental Backups with Percona Server and Percona XtraBackup / PLMCE 2014Fast Incremental Backups with Percona Server and Percona XtraBackup / PLMCE 2014
Fast Incremental Backups with Percona Server and Percona XtraBackup / PLMCE 2014
 
Linux internals for Database administrators at Linux Piter 2016
Linux internals for Database administrators at Linux Piter 2016Linux internals for Database administrators at Linux Piter 2016
Linux internals for Database administrators at Linux Piter 2016
 
All types of backups and restore
All types of backups and restoreAll types of backups and restore
All types of backups and restore
 
Firebird Scalability, by Dmitry Yemanov (in English)
Firebird Scalability, by Dmitry Yemanov (in English)Firebird Scalability, by Dmitry Yemanov (in English)
Firebird Scalability, by Dmitry Yemanov (in English)
 
Dba tuning
Dba tuningDba tuning
Dba tuning
 
MongoDB 101 & Beyond: Get Started in MongoDB 3.0, Preview 3.2 & Demo of Ops M...
MongoDB 101 & Beyond: Get Started in MongoDB 3.0, Preview 3.2 & Demo of Ops M...MongoDB 101 & Beyond: Get Started in MongoDB 3.0, Preview 3.2 & Demo of Ops M...
MongoDB 101 & Beyond: Get Started in MongoDB 3.0, Preview 3.2 & Demo of Ops M...
 
MySQL Backup and Security Best Practices
MySQL Backup and Security Best PracticesMySQL Backup and Security Best Practices
MySQL Backup and Security Best Practices
 
深入了解Redis
深入了解Redis深入了解Redis
深入了解Redis
 
Inno db datafiles backup and retore
Inno db datafiles backup and retoreInno db datafiles backup and retore
Inno db datafiles backup and retore
 
Exadata下的数据并行加载、并行卸载及性能监控
Exadata下的数据并行加载、并行卸载及性能监控Exadata下的数据并行加载、并行卸载及性能监控
Exadata下的数据并行加载、并行卸载及性能监控
 
Backup, Restore, and Disaster Recovery
Backup, Restore, and Disaster RecoveryBackup, Restore, and Disaster Recovery
Backup, Restore, and Disaster Recovery
 
Percona live linux filesystems and my sql
Percona live   linux filesystems and my sqlPercona live   linux filesystems and my sql
Percona live linux filesystems and my sql
 
TokuDB internals / Лесин Владислав (Percona)
TokuDB internals / Лесин Владислав (Percona)TokuDB internals / Лесин Владислав (Percona)
TokuDB internals / Лесин Владислав (Percona)
 
Optimizing columnar stores
Optimizing columnar storesOptimizing columnar stores
Optimizing columnar stores
 
Exploiting Your File System to Build Robust & Efficient Workflows
Exploiting Your File System to Build Robust & Efficient WorkflowsExploiting Your File System to Build Robust & Efficient Workflows
Exploiting Your File System to Build Robust & Efficient Workflows
 
2 db2 instance creation
2 db2 instance creation2 db2 instance creation
2 db2 instance creation
 
DB2UDB_the_Basics Day 4
DB2UDB_the_Basics Day 4DB2UDB_the_Basics Day 4
DB2UDB_the_Basics Day 4
 

Viewers also liked

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
 
Tracking Page Changes for Your Database and Bitmap Backups
Tracking Page Changes for Your Database and Bitmap BackupsTracking Page Changes for Your Database and Bitmap Backups
Tracking Page Changes for Your Database and Bitmap BackupsLaurynas Biveinis
 
PLAM 2015 - Evolving Backups Strategy, Devploying pyxbackup
PLAM 2015 - Evolving Backups Strategy, Devploying pyxbackupPLAM 2015 - Evolving Backups Strategy, Devploying pyxbackup
PLAM 2015 - Evolving Backups Strategy, Devploying pyxbackupJervin Real
 
My two cents about Mysql backup
My two cents about Mysql backupMy two cents about Mysql backup
My two cents about Mysql backupAndrejs Vorobjovs
 
MySQL Backup and Recovery Essentials
MySQL Backup and Recovery EssentialsMySQL Backup and Recovery Essentials
MySQL Backup and Recovery EssentialsRonald Bradford
 
Online MySQL Backups with Percona XtraBackup
Online MySQL Backups with Percona XtraBackupOnline MySQL Backups with Percona XtraBackup
Online MySQL Backups with Percona XtraBackupKenny Gryp
 

Viewers also liked (6)

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...
 
Tracking Page Changes for Your Database and Bitmap Backups
Tracking Page Changes for Your Database and Bitmap BackupsTracking Page Changes for Your Database and Bitmap Backups
Tracking Page Changes for Your Database and Bitmap Backups
 
PLAM 2015 - Evolving Backups Strategy, Devploying pyxbackup
PLAM 2015 - Evolving Backups Strategy, Devploying pyxbackupPLAM 2015 - Evolving Backups Strategy, Devploying pyxbackup
PLAM 2015 - Evolving Backups Strategy, Devploying pyxbackup
 
My two cents about Mysql backup
My two cents about Mysql backupMy two cents about Mysql backup
My two cents about Mysql backup
 
MySQL Backup and Recovery Essentials
MySQL Backup and Recovery EssentialsMySQL Backup and Recovery Essentials
MySQL Backup and Recovery Essentials
 
Online MySQL Backups with Percona XtraBackup
Online MySQL Backups with Percona XtraBackupOnline MySQL Backups with Percona XtraBackup
Online MySQL Backups with Percona XtraBackup
 

Similar to Uc2010 xtra backup-hot-backups-and-more

Percona Xtrabackup Best Practices
Percona Xtrabackup Best PracticesPercona Xtrabackup Best Practices
Percona Xtrabackup Best PracticesMarcelo Altmann
 
OSDC 2012 | Taking hot backups with XtraBackup by Alexey Kopytov
OSDC 2012 | Taking hot backups with XtraBackup by Alexey KopytovOSDC 2012 | Taking hot backups with XtraBackup by Alexey Kopytov
OSDC 2012 | Taking hot backups with XtraBackup by Alexey KopytovNETWAYS
 
MySQL Enterprise Backup (MEB)
MySQL Enterprise Backup (MEB)MySQL Enterprise Backup (MEB)
MySQL Enterprise Backup (MEB)Mydbops
 
Training Slides: 203 - Backup & Recovery
Training Slides: 203 - Backup & RecoveryTraining Slides: 203 - Backup & Recovery
Training Slides: 203 - Backup & RecoveryContinuent
 
Percona Xtrabackup - Highly Efficient Backups
Percona Xtrabackup - Highly Efficient BackupsPercona Xtrabackup - Highly Efficient Backups
Percona Xtrabackup - Highly Efficient BackupsMydbops
 
Presentation recovery manager (rman) configuration and performance tuning ...
Presentation    recovery manager (rman) configuration and performance tuning ...Presentation    recovery manager (rman) configuration and performance tuning ...
Presentation recovery manager (rman) configuration and performance tuning ...xKinAnx
 
Percona XtraBackup - New Features and Improvements
Percona XtraBackup - New Features and ImprovementsPercona XtraBackup - New Features and Improvements
Percona XtraBackup - New Features and ImprovementsMarcelo Altmann
 
ibbackup vs mysqldump对比测试 - 20080718
ibbackup vs mysqldump对比测试 - 20080718ibbackup vs mysqldump对比测试 - 20080718
ibbackup vs mysqldump对比测试 - 20080718Jinrong Ye
 
MySQL Enterprise Backup
MySQL Enterprise BackupMySQL Enterprise Backup
MySQL Enterprise BackupMario Beck
 
RMAN in 12c: The Next Generation (PPT)
RMAN in 12c: The Next Generation (PPT)RMAN in 12c: The Next Generation (PPT)
RMAN in 12c: The Next Generation (PPT)Gustavo Rene Antunez
 
How (not) to kill your MySQL infrastructure
How (not) to kill your MySQL infrastructureHow (not) to kill your MySQL infrastructure
How (not) to kill your MySQL infrastructureMiklos Szel
 
MySQL enterprise backup overview
MySQL enterprise backup overviewMySQL enterprise backup overview
MySQL enterprise backup overview郁萍 王
 
OpenStack DRaaS - Freezer - 101
OpenStack DRaaS - Freezer - 101OpenStack DRaaS - Freezer - 101
OpenStack DRaaS - Freezer - 101Trinath Somanchi
 
Kafka to the Maxka - (Kafka Performance Tuning)
Kafka to the Maxka - (Kafka Performance Tuning)Kafka to the Maxka - (Kafka Performance Tuning)
Kafka to the Maxka - (Kafka Performance Tuning)DataWorks Summit
 
Taming Oracle EBS R12.x Accrual Reconciliation Load
Taming Oracle EBS R12.x Accrual Reconciliation LoadTaming Oracle EBS R12.x Accrual Reconciliation Load
Taming Oracle EBS R12.x Accrual Reconciliation LoadJoshua Johnson, MIS
 
Anthony Somerset - Site Speed = Success!
Anthony Somerset - Site Speed = Success!Anthony Somerset - Site Speed = Success!
Anthony Somerset - Site Speed = Success!WordCamp Cape Town
 
[Altibase] 13 backup and recovery
[Altibase] 13 backup and recovery[Altibase] 13 backup and recovery
[Altibase] 13 backup and recoveryaltistory
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalabilityWim Godden
 

Similar to Uc2010 xtra backup-hot-backups-and-more (20)

Percona Xtrabackup Best Practices
Percona Xtrabackup Best PracticesPercona Xtrabackup Best Practices
Percona Xtrabackup Best Practices
 
OSDC 2012 | Taking hot backups with XtraBackup by Alexey Kopytov
OSDC 2012 | Taking hot backups with XtraBackup by Alexey KopytovOSDC 2012 | Taking hot backups with XtraBackup by Alexey Kopytov
OSDC 2012 | Taking hot backups with XtraBackup by Alexey Kopytov
 
MySQL Enterprise Backup (MEB)
MySQL Enterprise Backup (MEB)MySQL Enterprise Backup (MEB)
MySQL Enterprise Backup (MEB)
 
Training Slides: 203 - Backup & Recovery
Training Slides: 203 - Backup & RecoveryTraining Slides: 203 - Backup & Recovery
Training Slides: 203 - Backup & Recovery
 
Percona Xtrabackup - Highly Efficient Backups
Percona Xtrabackup - Highly Efficient BackupsPercona Xtrabackup - Highly Efficient Backups
Percona Xtrabackup - Highly Efficient Backups
 
Presentation recovery manager (rman) configuration and performance tuning ...
Presentation    recovery manager (rman) configuration and performance tuning ...Presentation    recovery manager (rman) configuration and performance tuning ...
Presentation recovery manager (rman) configuration and performance tuning ...
 
Percona XtraBackup - New Features and Improvements
Percona XtraBackup - New Features and ImprovementsPercona XtraBackup - New Features and Improvements
Percona XtraBackup - New Features and Improvements
 
Les 05 create_bu
Les 05 create_buLes 05 create_bu
Les 05 create_bu
 
ibbackup vs mysqldump对比测试 - 20080718
ibbackup vs mysqldump对比测试 - 20080718ibbackup vs mysqldump对比测试 - 20080718
ibbackup vs mysqldump对比测试 - 20080718
 
MySQL Enterprise Backup
MySQL Enterprise BackupMySQL Enterprise Backup
MySQL Enterprise Backup
 
RMAN in 12c: The Next Generation (PPT)
RMAN in 12c: The Next Generation (PPT)RMAN in 12c: The Next Generation (PPT)
RMAN in 12c: The Next Generation (PPT)
 
How (not) to kill your MySQL infrastructure
How (not) to kill your MySQL infrastructureHow (not) to kill your MySQL infrastructure
How (not) to kill your MySQL infrastructure
 
Les 02 config
Les 02 configLes 02 config
Les 02 config
 
MySQL enterprise backup overview
MySQL enterprise backup overviewMySQL enterprise backup overview
MySQL enterprise backup overview
 
OpenStack DRaaS - Freezer - 101
OpenStack DRaaS - Freezer - 101OpenStack DRaaS - Freezer - 101
OpenStack DRaaS - Freezer - 101
 
Kafka to the Maxka - (Kafka Performance Tuning)
Kafka to the Maxka - (Kafka Performance Tuning)Kafka to the Maxka - (Kafka Performance Tuning)
Kafka to the Maxka - (Kafka Performance Tuning)
 
Taming Oracle EBS R12.x Accrual Reconciliation Load
Taming Oracle EBS R12.x Accrual Reconciliation LoadTaming Oracle EBS R12.x Accrual Reconciliation Load
Taming Oracle EBS R12.x Accrual Reconciliation Load
 
Anthony Somerset - Site Speed = Success!
Anthony Somerset - Site Speed = Success!Anthony Somerset - Site Speed = Success!
Anthony Somerset - Site Speed = Success!
 
[Altibase] 13 backup and recovery
[Altibase] 13 backup and recovery[Altibase] 13 backup and recovery
[Altibase] 13 backup and recovery
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
 

More from Arvids Godjuks

Open sql2010 recovery-of-lost-or-corrupted-innodb-tables
Open sql2010 recovery-of-lost-or-corrupted-innodb-tablesOpen sql2010 recovery-of-lost-or-corrupted-innodb-tables
Open sql2010 recovery-of-lost-or-corrupted-innodb-tablesArvids Godjuks
 
Alexandr Makarov - PHP framework Yii
Alexandr Makarov - PHP framework YiiAlexandr Makarov - PHP framework Yii
Alexandr Makarov - PHP framework YiiArvids Godjuks
 
Zabbix - an important part of your IT infrastructure
Zabbix - an important part of your IT infrastructureZabbix - an important part of your IT infrastructure
Zabbix - an important part of your IT infrastructureArvids Godjuks
 
PHP libevent Daemons. A high performance and reliable solution. Practical exp...
PHP libevent Daemons. A high performance and reliable solution. Practical exp...PHP libevent Daemons. A high performance and reliable solution. Practical exp...
PHP libevent Daemons. A high performance and reliable solution. Practical exp...Arvids Godjuks
 
Google Analytics: smart use
Google Analytics: smart useGoogle Analytics: smart use
Google Analytics: smart useArvids Godjuks
 
High Availability Solutions with MySQL
High Availability Solutions with MySQLHigh Availability Solutions with MySQL
High Availability Solutions with MySQLArvids Godjuks
 
Detecting logged in user's abnormal activity
Detecting logged in user's abnormal activityDetecting logged in user's abnormal activity
Detecting logged in user's abnormal activityArvids Godjuks
 

More from Arvids Godjuks (8)

Open sql2010 recovery-of-lost-or-corrupted-innodb-tables
Open sql2010 recovery-of-lost-or-corrupted-innodb-tablesOpen sql2010 recovery-of-lost-or-corrupted-innodb-tables
Open sql2010 recovery-of-lost-or-corrupted-innodb-tables
 
Alexandr Makarov - PHP framework Yii
Alexandr Makarov - PHP framework YiiAlexandr Makarov - PHP framework Yii
Alexandr Makarov - PHP framework Yii
 
Zabbix - an important part of your IT infrastructure
Zabbix - an important part of your IT infrastructureZabbix - an important part of your IT infrastructure
Zabbix - an important part of your IT infrastructure
 
PHP libevent Daemons. A high performance and reliable solution. Practical exp...
PHP libevent Daemons. A high performance and reliable solution. Practical exp...PHP libevent Daemons. A high performance and reliable solution. Practical exp...
PHP libevent Daemons. A high performance and reliable solution. Practical exp...
 
System markup
System markupSystem markup
System markup
 
Google Analytics: smart use
Google Analytics: smart useGoogle Analytics: smart use
Google Analytics: smart use
 
High Availability Solutions with MySQL
High Availability Solutions with MySQLHigh Availability Solutions with MySQL
High Availability Solutions with MySQL
 
Detecting logged in user's abnormal activity
Detecting logged in user's abnormal activityDetecting logged in user's abnormal activity
Detecting logged in user's abnormal activity
 

Uc2010 xtra backup-hot-backups-and-more

  • 1. XtraBackup: Hot Backups and More Vadim Tkachenko Morgan Tocker http://percona.com http://MySQLPerformanceBlog.com MySQL CE Apr 2010
  • 2. Introduction • Vadim Tkachenko – Percona Inc, CTO and Lead of Development • Morgan Tocker – Percona Inc, Director of Training XtraBackup: Hot Backups and More -2-
  • 3. Comparing Backup Options Engine s Warmth Flex Backup Flex Restore Backup time Restore time Binlog coord Impact mysqldump InnoDB/X traDB HOT ROW MOST MED WORST YES MEDIUM mysqldump ALL WARM ROW MOST MED WORST YES MEDIUM Snapshot ALL MOSTLY HOT SYSTEM SYSTEM SLOW- MED BEST YES HEAVY XtraBackup InnoDB/X traDB HOT TABLE TABLE FAST BEST YES LOW InnoDB Hot Backup InnoDB HOT TABLE TABLE FAST BEST YES LOW XtraBackup / InnoDB Hot Backup ALL WARM TABLE TABLE FAST BEST YES MEDIUM/ LARGE MySQLHotC opy MyISAM WARM TABLE TABLE FAST BEST YES LOW Cold Backup ALL COLD SYSTEM SYSTEM BEST BEST YES VERY HEAVY XtraBackup: Hot Backups and More -3-
  • 4. What is talk about • XtraBackup • Internals • Basic and advance usage XtraBackup: Hot Backups and More -4-
  • 5. Idea • Copy XtraDB / InnoDB tables without stopping server ( and locking tables) • Challenge: Tables are being changed in background • Alternative solutions – ZFS snapshot ( Solaris / FreeBSD) – LVM, good if performance is not concern • 160 ios -> 25 ios • ~20% space reservation – InnoDB Hot Backup / Oracle Online Backup • Commercial, per-server, last release 2006 ? • Can be expensive for X,000 servers XtraBackup: Hot Backups and More -5-
  • 6. Solution • Copy tables and log changes – InnoDB transactional redo logs are doing the same – XtraBackup is mini instance of XtraDB / InnoDB – Idea taken from InnoDB Hot Backup XtraBackup: Hot Backups and More -6-
  • 7. Basic design • Copy tables, log changes into xtrabackup_logfile • Prepare – apply log to copied tables XtraBackup: Hot Backups and More -7- copy xtrabackup_logfile tables New location changes
  • 8. XtraBackup • Non-blocking online backup of XtraDB / InnoDB / InnoDB–plugin tables • Blocking for MyISAM XtraBackup: Hot Backups and More -8-
  • 9. Tools • Binaries – xtrabackup • Copy .ibd & xtrabackup_logfile – tar4ibd • Script – innobackupex-1.5.1 • Taken from InnoDB Hot Backup (GPL) , heavily modified • Copy .frm, myisam, locking etc XtraBackup: Hot Backups and More -9-
  • 10. Basic usage • innobackupex-1.5.1 /destination/dir • innobackupex-1.5.1 --apply-log /backup/dir – --use-memory (1GB defaults) • innobackupex-1.5.1 --throttle=IOS /destination/dir XtraBackup: Hot Backups and More -10-
  • 11. Stream • innobackupex-1.5.1 --stream=tar ./ > backup.tar • Tar compatible stream ( -i required to extract) – Tar was replaced by libtar and tar4ibd • Compress – innobackupex-1.5.1 --stream=tar ./ | gzip - > backup.tar.gz • Copy to remote host – innobackupex-1.5.1 --stream=tar ./ | ssh vadim@desthost "cat - > /data/vol1/mysqluc/backup.tar“ • The same but with throttling – innobackupex --stream=tar | pv -q -L10m | ssh vadim@desthost "tar xfi -" XtraBackup: Hot Backups and More -11-
  • 12. Slave • To setup slave from master – No specific actions needed • File xtrabackup_binlog_info mysql-bin.000020 70206554 • To backup from slave – innobackupex-1.5.1 --slave-info /destination/dir • LOCK caveats – FLUSH TABLES WITH READ LOCK to get master/slave info and to copy MYISAM tables – 100GB of MyISAM tables will cause a problem XtraBackup: Hot Backups and More -12-
  • 13. Incremental/Differential • We are able to copy only changes from last backup – xtrabackup --backup --target-dir=/data/backups/incremental --incremental- basedir=/data/backups/2010-04-11_17-55-54 • From output: – … xtrabackup: The latest check point (for incremental): '2438774348‘ … • xtrabackup --prepare --target-dir=/data/vadim/mysqluc/2010-04-11_20-45-42 --incremental- dir=/data/vadim/mysqluc/incremental XtraBackup: Hot Backups and More -13- Copy only changes since LSN xtrabackup_logfile tables New location changes
  • 14. Export/import • Export only table to another server – xtrabackup --table=tpcc.order_line --backup --target- dir=/data/vadim/mysqluc/order_line/ • Prepare – xtrabackup --prepare --export --target- dir=/data/vadim/mysqluc/order_line/ • Copy to remote host (it has to be XtraDB) – alter table order_line discard tablespace; – set global innodb_expand_import=1; – alter table order_line import tablespace; XtraBackup: Hot Backups and More -14-
  • 15. Statistics • Show details on tablespaces / indexes table: tpcc/order_line, index: PRIMARY, space id: 25, root page: 3, zip size: 0 estimated statistics in dictionary: key vals: 32471816, leaf pages: 264267, size pages: 302592 real statistics: level 2 pages: pages=1, data=8406 bytes, data/pages=51% level 1 pages: pages=467, data=4756806 bytes, data/pages=62% leaf pages: recs=35116662, pages=264267, data=2410713870 bytes, data/pages=55% XtraBackup: Hot Backups and More -15-
  • 16. Thank you! • Questions? • vadim@percona.com • morgan@percona.com XtraBackup: Hot Backups and More -16-