Documentation Home
MySQL Enterprise Backup 3.12 User's Guide
Related Documentation Download this Manual
PDF (US Ltr) - 1.1Mb
PDF (A4) - 1.1Mb
HTML Download (TGZ) - 174.2Kb
HTML Download (Zip) - 199.7Kb


4.2.1 Backing Up an Entire MySQL Instance

In the following example, we back up an entire MySQL instance to a single file using the backup-to-image command, which appears at the end of the sample command. We specify some of the connection information for the database using the --user and --host options (and, with the --password option, tell the MySQL server to prompt for a user password). The location and filename for the single-file backup is specified using the --backup-image option, and the location for an empty folder to store temporary files is supplied with the --backup-dir option.

The output echoes all the parameters used by the backup operation, including several that are retrieved automatically using the database connection. The unique ID for this backup job is recorded in special tables that mysqlbackup creates inside the MySQL instance, allowing you to monitor long-running backups and view information on previous backups. The final output section repeats the location of the backup data and provides the LSN values that you might use when you perform an incremental backup next time over the full backup that has just been made.

$ ./mysqlbackup --user=root --password --host=127.0.0.1 --backup-image=/home/admin/backups/my.mbi \
    --backup-dir=/home/admin/backup-tmp backup-to-image
 
MySQL Enterprise Backup version 3.12.3 Linux-2.6.18-274.el5-i686 [2014/11/12] 
Copyright (c) 2003, 2014, Oracle and/or its affiliates. All Rights Reserved.

 mysqlbackup: INFO: Starting with following command line ...
 ./mysqlbackup --user=root --password --host=127.0.0.1 
        --backup-image=/home/admin/backups/my.mbi 
        --backup-dir=/home/admin/backup-tmp backup-to-image 

 mysqlbackup: INFO: 
Enter password: 
 mysqlbackup: INFO: MySQL server version is '5.6.17-log'.
 mysqlbackup: INFO: Got some server configuration information from running server.

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

141204 12:54:55 mysqlbackup: INFO: MEB logfile created at /home/admin/backup-tmp/meta/MEB_2014-12-04.12-54-55_image_backup.log

--------------------------------------------------------------------
                       Server Repository Options:
--------------------------------------------------------------------
  datadir = /var/lib/mysql/
  innodb_data_home_dir = 
  innodb_data_file_path = ibdata1:12M:autoextend
  innodb_log_group_home_dir = /var/lib/mysql/
  innodb_log_files_in_group = 2
  innodb_log_file_size = 50331648
  innodb_page_size = 16384
  innodb_checksum_algorithm = innodb
  innodb_undo_directory = /var/lib/mysql/
  innodb_undo_tablespaces = 0
  innodb_undo_logs = 128

--------------------------------------------------------------------
                       Backup Config Options:
--------------------------------------------------------------------
  datadir = /home/admin/backup-tmp/datadir
  innodb_data_home_dir = /home/admin/backup-tmp/datadir
  innodb_data_file_path = ibdata1:12M:autoextend
  innodb_log_group_home_dir = /home/admin/backup-tmp/datadir
  innodb_log_files_in_group = 2
  innodb_log_file_size = 50331648
  innodb_page_size = 16384
  innodb_checksum_algorithm = innodb
  innodb_undo_directory = /home/admin/backup-tmp/datadir
  innodb_undo_tablespaces = 0
  innodb_undo_logs = 128

Backup Image Path = /home/admin/backups/my.mbi
 mysqlbackup: INFO: Unique generated backup id for this is 14177156956623554

 mysqlbackup: INFO: Creating 14 buffers each of size 16777216.
141204 12:54:58 mysqlbackup: INFO: Full Image Backup operation starts with following threads
		1 read-threads    6 process-threads    1 write-threads
141204 12:54:58 mysqlbackup: INFO: System tablespace file format is Antelope.
141204 12:54:58 mysqlbackup: INFO: Starting to copy all innodb files...
 mysqlbackup: INFO: Copying meta file /home/admin/backup-tmp/backup-my.cnf.
 mysqlbackup: INFO: Copying meta file /home/admin/backup-tmp/meta/backup_create.xml.
141204 12:54:58 mysqlbackup: INFO: Found checkpoint at lsn 1631766.
141204 12:54:58 mysqlbackup: INFO: Starting log scan from lsn 1631744.
141204 12:54:58 mysqlbackup: INFO: Copying log...
141204 12:54:58 mysqlbackup: INFO: Log copied, lsn 1631766.
141204 12:54:58 mysqlbackup: INFO: Copying /var/lib/mysql/ibdata1 (Antelope file format).
141204 12:54:59 mysqlbackup: INFO: Copying /var/lib/mysql/mysql/innodb_index_stats.ibd (Antelope file format).
141204 12:54:59 mysqlbackup: INFO: Copying /var/lib/mysql/mysql/innodb_table_stats.ibd (Antelope file format).
141204 12:54:59 mysqlbackup: INFO: Copying /var/lib/mysql/mysql/slave_master_info.ibd (Antelope file format).
141204 12:55:00 mysqlbackup: INFO: Copying /var/lib/mysql/mysql/slave_relay_log_info.ibd (Antelope file format).
141204 12:55:00 mysqlbackup: INFO: Copying /var/lib/mysql/mysql/slave_worker_info.ibd (Antelope file format).
141204 12:55:00 mysqlbackup: INFO: Copying /var/lib/mysql/test2/tb1.ibd (Antelope file format).
141204 12:55:00 mysqlbackup: INFO: Completing the copy of innodb files.
141204 12:55:00 mysqlbackup: INFO: Starting to copy Binlog files...
141204 12:55:01 mysqlbackup: INFO: Preparing to lock tables: Connected to mysqld server.
141204 12:55:01 mysqlbackup: INFO: Starting to lock all the tables...
141204 12:55:02 mysqlbackup: INFO: All tables are locked and flushed to disk
141204 12:55:02 mysqlbackup: INFO: Completed the copy of binlog files...
141204 12:55:02 mysqlbackup: INFO: Opening backup source directory '/var/lib/mysql/'
141204 12:55:02 mysqlbackup: INFO: Starting to backup all non-innodb files in 
	subdirectories of '/var/lib/mysql/'
141204 12:55:02 mysqlbackup: INFO: Adding database directory: datadir/mysql
141204 12:55:02 mysqlbackup: INFO: Adding database directory: datadir/performance_schema
141204 12:55:02 mysqlbackup: INFO: Completing the copy of all non-innodb files.
141204 12:55:02 mysqlbackup: INFO: Adding database directory: datadir/test
141204 12:55:02 mysqlbackup: INFO: Adding database directory: datadir/test2
141204 12:55:04 mysqlbackup: INFO: A copied database page was modified at 1631766.
          (This is the highest lsn found on page)
          Scanned log up to lsn 1631766.
          Was able to parse the log up to lsn 1631766.
          Maximum page number for a log record 0
141204 12:55:04 mysqlbackup: INFO: All tables unlocked
141204 12:55:04 mysqlbackup: INFO: All MySQL tables were locked for 2.057 seconds.
141204 12:55:04 mysqlbackup: INFO: Reading all global variables from the server.
141204 12:55:04 mysqlbackup: INFO: Completed reading of all global variables from the server.
141204 12:55:04 mysqlbackup: INFO: Creating server config files server-my.cnf and server-all.cnf in /home/admin/backup-tmp
 mysqlbackup: INFO: Copying meta file /home/admin/backup-tmp/meta/backup_variables.txt.
 mysqlbackup: INFO: Copying meta file /home/admin/backup-tmp/datadir/ibbackup_logfile.
 mysqlbackup: INFO: Copying meta file /home/admin/backup-tmp/server-all.cnf.
 mysqlbackup: INFO: Copying meta file /home/admin/backup-tmp/server-my.cnf.
 mysqlbackup: INFO: Copying meta file /home/admin/backup-tmp/meta/backup_content.xml.
 mysqlbackup: INFO: Copying meta file /home/admin/backup-tmp/meta/image_files.xml.
141204 12:55:08 mysqlbackup: INFO: Full Image Backup operation completed successfully.
141204 12:55:08 mysqlbackup: INFO: Backup image created successfully.
 mysqlbackup: INFO: Image Path = /home/admin/backups/my.mbi
141204 12:55:08 mysqlbackup: INFO: MySQL binlog position: filename mysqld-bin.000004, position 120

-------------------------------------------------------------
   Parameters Summary         
-------------------------------------------------------------
   Start LSN                  : 1631744
   End LSN                    : 1631766
-------------------------------------------------------------

mysqlbackup completed OK!

User Comments
User comments in this section are, as the name implies, provided by MySQL users. The MySQL documentation team is not responsible for, nor do they endorse, any of the information provided here.
Sign Up Login You must be logged in to post a comment.