Solved

mysqldump --single-transaction for online backup

Posted on 2014-09-16
7
1,026 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 500 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
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
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…

729 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