Solved

mysqldump --single-transaction for online backup

Posted on 2014-09-16
7
885 Views
Last Modified: 2014-09-23
Hi experts,

I found the option --single-transaction for mysqldump.
Some forums tell, that using this option, a database can be backed up without locking tables.
How would this work? Why should we use Percona xtrabackup for online database backups if we could simply use mysqldump with --singe-transaction?

I have in mind that mysqldump is not a tool for online backup?
Can you confirm that?

If we use --single-transaction on a production database. Would this be OK?

IT is the goal the have a complete database-backup without interfering the qpplication, which uses the database.

Many thanks in advance!
Roland
0
Comment
Question by:Systemadministration
  • 4
  • 3
7 Comments
 
LVL 23

Expert Comment

by:nemws1
Comment Utility
Sure.  --single-transaction was added specifically for production databases.  It takes advantage of the transactional capabilities of InnoDB to backup a consistent state without locking the tables.

Note - it *only* works on InnoDB tables.  MyISAM/HEAP tables will be backed up without issuing any table locks and may result in inconsistent data!

I would recommend using --single-transaction for your InnoDB tables and to do a locked table backup for your non-InnoDB tables.
0
 

Author Comment

by:Systemadministration
Comment Utility
We only have InnoDB at the Moment.
But is there a maximum size of database while using single-transaction or mysqldump in general?
0
 
LVL 23

Accepted Solution

by:
nemws1 earned 500 total points
Comment Utility
No, no max for InnoDB and single-trans.  It more depends on how many transactions are going on while the database is being backed up.  The server will slow down while the backup is running because any write transactions are spooled to the binary log and *not* written out to disk (as you're backing up what is on disk).  So, if you have a *lot* of transaction against your DB while you are backing it up, those will slow down.  If you have a really big database that takes a long while to back up, this might be a performance issue.

You should hopefully already be backing up your database during a "dead" time (8pm, 2pm, or whatever) so it really shouldn't be an issue.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:Systemadministration
Comment Utility
OK, but you mean the InnoDB internal Binary-Logging, not the MySQL Binary-Log.
Because MySQL Binary Log is not active.
0
 
LVL 23

Expert Comment

by:nemws1
Comment Utility
Yup.  InnoDB binary log.
0
 

Author Comment

by:Systemadministration
Comment Utility
OK, till now we used following:

mysqldump --opt -Q [dbname] -u xxx -p > test.sql

I read that --opt and -Q ist Standard. Can I use mysqldump as follows to get consistent dupms:

mysqldump --single-transaction --quick [dbname] -u xxx -p > test.sql


Thanks a lot!
0
 
LVL 23

Expert Comment

by:nemws1
Comment Utility
Yes, that looks good to me.
0

Featured Post

Google Storage: Standard vs. Nearline vs. Coldline

Google Cloud Storage has a number of classes to choose from. Although there are a lot in common, they vary in price and usage terms. This post explains Google Cloud Storage classes and helps to understand which  one to choose.

Join & Write a Comment

VM backups can be lost due to a number of reasons: accidental backup deletion, backup file corruption, disk failure, lost or stolen hardware, malicious attack, or due to some other undesired and unpredicted event. Thus, having more than one copy of …
Create your own, high-performance VM backup appliance by installing NAKIVO Backup & Replication directly onto a Synology NAS!
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…
This tutorial will walk an individual through the process of installing the necessary services and then configuring a Windows Server 2012 system as an iSCSI target. To install the necessary roles, go to Server Manager, and select Add Roles and Featu…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now