?
Solved

mysqldump --single-transaction for online backup

Posted on 2014-09-16
7
Medium Priority
?
1,083 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 23

Expert Comment

by:nemws1
ID: 40325545
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
ID: 40325620
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 2000 total points
ID: 40325645
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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

Author Comment

by:Systemadministration
ID: 40327366
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
ID: 40328102
Yup.  InnoDB binary log.
0
 

Author Comment

by:Systemadministration
ID: 40338484
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
ID: 40340206
Yes, that looks good to me.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
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…
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

752 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