通过xtrabackup工具对mysql数据库做全备

需求描述:

  使用xtrabackup工具对mysql实例中的所有的数据库进行备份,并且将备份的过程输出到指定的日志文件中.

操作过程:

1.使用xtrabacup工具备份mysql实例

xtrabackup --backup -uroot -pmysql \
--target-dir=/home/mysql/workspace/mysql_backup/FullBackup/Full_Backup_2018-- \
>/home/mysql/workspace/mysql_backup/FullBackup/Full_Backup_2018--.log

备注:xtrabackup执行过程的内容会输出到STDERR,所以,直接使用>即STDOUT是不能将输出重定向到文件的.--target-dir指定了要将备份写到哪个目录下,--backup就是对mysql实例做备份

2.查看生成的备份文件及日志

[mysql@redhat6 FullBackup]$ ll
total
drwxr-x--- mysql mysql Apr : Full_Backup_2018--
-rw-rw-r-- mysql mysql Apr : Full_Backup_2018--.log #备份日志中是有内容的.
[mysql@redhat6 FullBackup]$ pwd
/home/mysql/workspace/mysql_backup/FullBackup

查看日志:

-rw-rw-r--   mysql mysql  Apr  : Full_Backup_2018--.log
[mysql@redhat6 FullBackup]$ pwd
/home/mysql/workspace/mysql_backup/FullBackup
[mysql@redhat6 FullBackup]$ more Full_Backup_2018--.log
:: version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;port=3306;mysql_socket=/tmp/mysql.sock' as 'root' (using password: YES).
:: version_check Connected to MySQL server
:: version_check Executing a version check against the server...
:: version_check Done.
:: Connecting to MySQL server host: localhost, user: root, password: set, port: , socket: /tmp/mysql.sock
Using server version 5.5.-log
xtrabackup version 2.4. based on MySQL server 5.7. Linux (x86_64) (revision id: 3198bce)
xtrabackup: uses posix_fadvise().
xtrabackup: cd to /mysql/data
xtrabackup: open files limit requested , set to
xtrabackup: using the following InnoDB configuration:
xtrabackup: innodb_data_home_dir = .
xtrabackup: innodb_data_file_path = ibdata1:100M:autoextend
xtrabackup: innodb_log_group_home_dir = /mysql/data/
xtrabackup: innodb_log_files_in_group =
xtrabackup: innodb_log_file_size =
InnoDB: Number of pools:
:: >> log scanned up to ()
xtrabackup: Generating a list of tablespaces
InnoDB: Allocated tablespace ID for employees/employees, old maximum was
:: >> log scanned up to ()
:: >> log scanned up to ()
:: >> log scanned up to ()
:: >> log scanned up to ()
:: >> log scanned up to ()
:: [] Copying ./ibdata1 to /home/mysql/workspace/mysql_backup/FullBackup/Full_Backup_2018--/ibdata1
:: >> log scanned up to ()
:: >> log scanned up to ()
:: >> log scanned up to ()
:: >> log scanned up to ()
:: >> log scanned up to ()
:: >> log scanned up to ()
:: >> log scanned up to ()
:: >> log scanned up to ()
:: >> log scanned up to ()
:: >> log scanned up to ()
:: >> log scanned up to ()
:: >> log scanned up to ()

备注:说明全备份没有问题,并且也产生了日志文件.

文档创建时间:2018年4月19日11:46:14

上一篇:Book Review of “The practice of programming” (Ⅳ)


下一篇:【转】仿QQ5.0侧滑菜单ResideMenu