TokuDB tips: MySQL backups_MySQL
In my recent post, “TokuDB gotchas: slow INFORMATION_SCHEMA TABLES,” I saw a couple questions and tweets asking if we use TokuDB in production. Actually I mentioned it in that post and we also blogged about it in a couple of other recent posts:
- Getting to know TokuDB for MySQL
- Percona Server with TokuDB: Packing 15TB into local SSDs
So, yes, we are using Percona Server + TokuDB as a main storage engine inPercona Cloud Toolsto store timeseries data.
And, yes, Percona Server + TokuDB is available GAPercona Server 5.6.19-67.0 with TokuDB (GA).
Just having good performance is not enough to make it into production; there are also operational questions and one such question is about backups. I want to explain how we do backups for Percona Server + TokuDB inPercona Cloud Tools.
I should say up front, that weDO NOThave support for TokuDB inPercona XtraBackup. TokuDB internals are significantly different from InnoDB/XtraDB, so it will be a major project to add this to Percona XtraBackup and we do not have any plans at the moment to work on this.
It does not mean that TokuDB users do not have options for backups. There is Tokutek Hot back-up, included in theTokutek Enterpise Subscription. And there is a method we use inPercona Cloud Tools: LVM Backups. We usemylvmbackupscripts for this task and it works fairly well for us.
There is however some gotchas to be aware. If you understand an LVM backups mechanic, this is basically a managed crash recovery process when you restore from a backup.
Now we need to go in a little detail for TokuDB. To support transactions that involve both TokuDB and InnoDB engines, TokuDB uses a two-phase commit mechanism in MySQL. When involved, the two-phase commit requires binary logs presented for a proper recovery procedures.
But now we need to take a look at how we setup a binary log in Percona Cloud Tools. We used SSD for the main data storage (LVM partition is here) and we use a Hardware RAID1 over two hard-drives for binary logs. We choose this setup as we care about SSD lifetime. In write-intensive workloads, binary logs will produce a lot of write operations and in our calculation we will just burn these SSDs, so we have to store them on something less expensive.
So the problem there is that when we take an LVM snapshot over main storage, we do not have a consistent view of binary logs(although it is possible to modify backup scripts to copy the current binary log under FLUSH TABLES WITH READ LOCK operation, this is probably what we will do next). But binary logs are needed for recovery, without them we face these kind of errors during restoring from backup:
2014-DD-MM 02:15:16 16414 [Note] Found 1 prepared transaction(s) in TokuDB2014-DD-MM 02:15:16 16414 [ERROR] Found 1 prepared transactions! It means that mysqld was not shut down properly last time and critical recovery information (last binlog or tc.log file) was manually deleted after a crash. You have to start mysqld with --tc-heuristic-recover switch to commit or rollback pending transactions.2014-DD-MM 02:15:16 16414 [ERROR] Aborting
2014-DD-MM02:15:1616414[Note]Found1preparedtransaction(s)inTokuDB 2014-DD-MM02:15:1616414[ERROR]Found1preparedtransactions!Itmeansthatmysqldwasnotshutdownproperlylasttimeandcriticalrecoveryinformation(lastbinlogortc.logfile)wasmanuallydeletedafteracrash.Youhavetostartmysqldwith--tc-heuristic-recoverswitchtocommitorrollbackpendingtransactions. 2014-DD-MM02:15:1616414[ERROR]Aborting |
The error message actually hints a way out. Unfortunately it seems that we are the first ones to have ever tried this option, astc-heuristic-recover
istotally broken in current MySQLand not supposed to work… and it would be noticed if someone really tried it before us(which gives me an impression that Oracle/MySQL never properly tested it, but that is a different story).
We will fix this inPercona Server soon.
So the way to handle a recovery from LVM backup without binary logs is to start mysqld with –tc-heuristic-recover switch(unfortunately I did not figure out yet, should it be COMMIT or ROLLBACK value, hehe).
The proper way to use LVM backup is to have a corresponding binary log file, like I said it will require a modification to mylvmbackup script.
I should say this is not the only way we do backups in Percona Cloud Tools. In this project we usePercona Backup Serviceprovided by thePercona Managed Services team, and our team also usesmydumperto perform a logical backup of data.
While it works acceptably to backup hundreds of gigabytes worth of data(it is just a sequential scan, which should be easy for TokuDB), the full recovery is painful and takes unacceptably long. So mydumper backup(recovery)will be used if we ever need to perform a fine-grained recovery(i.e only small amount of specific tables).
So I hope this tip is useful if you are looking for info about how to do backups for TokuDB.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(159 characters)
