MySQL Enterprise Backup Part I


This is the first in a series of postings on the MySQL Enterprise tools. I know most of you reading are dedicated community server users but you may have wondered ‘What do you get when you buy MySQL Enterprise server?’

Well, first of all, you can try the Enterprise Server for free for thirty days. Point your browser to Oracle Software Delivery Cloud and download. Hopefully you can following along with me as I try the various Enterprise tools starting with MySQL Enterprise Backup.

Data backups have long been a part of my professional life. My ‘first real’ job was backing up data on a DEC Tops-10 system that ran the University of San Diego. Much of my working time at night was spent loading, unloading, and monitoring reel tapes as the data from the washing machine sized disk drives was spread over magnetic oxide bonded to plastic strips at 1600 BPI. And occasionally one of the tapes would not record correctly or the tape drive would ‘chew’ a critical part of the tape.

Most of you backing up your MySQL instances are either using a tool like mysqldump to serialize data into some sort of file or using a snapshot like lvm to freeze the data. Nothing wrong with either. Both can serve the intended purpose of saving the data. But how easy is it to restore one row, one table, one database, or a bunch of databases?

MySQL Enterprise Backup or MEB can perform hot or cold backups, partial or incremental, and backup of InnoDB tables takes place entirely online, without blocking queries or updates. It runs in separate process space than the server instance. And it works with multiple storage engines.

After downloading the MEB program and perusing the docs, I made my first attempt at saving my current test instance. Please note the backup-and-apply-log option that will brings all InnoDB tables up to date with any changes made during the backup.

mysqlbackup --backup-dir=/home/dstokes/foo2 backup-and-apply-log --user=root -p
MySQL Enterprise Backup version 3.6.0 [2011/07/01]
Copyright (c) 2003, 2011, Oracle and/or its affiliates. All Rights Reserved.

INFO: Starting with following command line ...
./mysqlbackup --backup-dir=/home/dstokes/foo2 backup-and-apply-log --user=root -p

Enter password:
INFO: Got some server configuration information from running server.

IMPORTANT: Please check that mysqlbackup run completes successfully.
At the end of a successful 'backup-and-apply-log' run mysqlbackup
prints "mysqlbackup completed OK!".

--------------------------------------------------------------------
Server Repository Options:
--------------------------------------------------------------------
datadir = /usr/local/mysql/data/
innodb_data_home_dir = /usr/local/mysql/data
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /usr/local/mysql/data
innodb_log_files_in_group = 2
innodb_log_file_size = 67108864

--------------------------------------------------------------------
Backup Config Options:
--------------------------------------------------------------------
datadir = /home/dstokes/foo2/datadir
innodb_data_home_dir = /home/dstokes/foo2/datadir
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /home/dstokes/foo2/datadir
innodb_log_files_in_group = 2
innodb_log_file_size = 67108864

mysqlbackup: INFO: Unique generated backup id for this is 13198201746536620
mysqlbackup: INFO: Uses posix_fadvise() for performance optimization.
mysqlbackup: INFO: System tablespace file format is Antelope.
mysqlbackup: INFO: Found checkpoint at lsn 14644327.
mysqlbackup: INFO: Starting log scan from lsn 14644224.
111028 11:42:54 mysqlbackup: INFO: Copying log...
111028 11:42:55 mysqlbackup: INFO: Log copied, lsn 14644327.
We wait 1 second before starting copying the data files...
111028 11:42:56 mysqlbackup: INFO: Copying /usr/local/mysql/data/ibdata1 (Antelope file format).
mysqlbackup: INFO: Preparing to lock tables: Connected to mysqld server.
111028 11:42:57 mysqlbackup: INFO: Starting to lock all the tables....
111028 11:42:57 mysqlbackup: INFO: All tables are locked and flushed to disk
mysqlbackup: INFO: Opening backup source directory '/usr/local/mysql/data/'
111028 11:42:57 mysqlbackup: INFO: Starting to backup all files in subdirectories of '/usr/local/mysql/data/'
mysqlbackup: INFO: Backing up the database directory 'grimm'
mysqlbackup: INFO: Backing up the database directory 'mysql'
mysqlbackup: INFO: Backing up the database directory 'performance_schema'
mysqlbackup: INFO: Backing up the database directory 'test'
mysqlbackup: INFO: Backing up the database directory 'world'
mysqlbackup: INFO: Copying innodb data and logs during final stage ...
mysqlbackup: INFO: A copied database page was modified at 14644327.
(This is the highest lsn found on page)
Scanned log up to lsn 14646207.
Was able to parse the log up to lsn 14646207.
Maximum page number for a log record 703
111028 11:42:57 mysqlbackup: INFO: All tables unlocked
mysqlbackup: INFO: All MySQL tables were locked for 0.000 seconds
111028 11:42:57 mysqlbackup: INFO: Full backup completed!
mysqlbackup: INFO: Backup created in directory '/home/dstokes/foo2'
111028 11:42:57 mysqlbackup: INFO: ibbackup_logfile's creation parameters:
start lsn 14644224, end lsn 14646207,
start checkpoint 14644327.
InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 Setting log file size to 0 67108864
Setting log file size to 0 67108864
mysqlbackup: INFO: We were able to parse ibbackup_logfile up to
lsn 14646207.
mysqlbackup: INFO: The first data file is '/home/dstokes/foo2/datadir/ibdata1'
and the new created log files are at '/home/dstokes/foo2/datadir/'
mysqlbackup: INFO: System tablespace file format is Antelope.
111028 11:43:00 mysqlbackup: INFO: Full backup prepared for recovery successfully!

-------------------------------------------------------------
Parameters Summary
-------------------------------------------------------------
Start LSN : 14644224
End LSN : 14646207
-------------------------------------------------------------

mysqlbackup completed OK!

MEB created a backup-my.cnf to record some information on instance, plus two directories — datadir and meta.

Next time: Can I restore?

About these ads

2 Comments

Filed under MySQL Enterprise

2 responses to “MySQL Enterprise Backup Part I

  1. arvi

    Its very nice article.
    I have one doubt.
    I took mysql compress full backup (innodb+myisam) using MEB-3.5.
    Location of backup is /restore. At the time of restore, I have to uncompress ibdata1.ibz file. So have have moved ibdata1.ibz file into another mount-point /test.
    I want to uncompress ibdata.ibz data file at /restore location.
    How can I do this. What changes should I make in backup-my.ini file please/

    Thank you.
    Arvi

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s