Solved

mysqldump --single-transaction for online backup

Posted on 2014-09-16
7
929 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
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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

A quick step-by-step overview of installing and configuring Carbonite Server Backup.
VM backup deduplication is a method of reducing the amount of storage space needed to save VM backups. In most organizations, VMs contain many duplicate copies of data, such as VMs deployed from the same template, VMs with the same OS, or VMs that h…
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…

776 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