安装Xtrabackup(尽量安装高版本的)
下载地址:https://www.percona.com/downloads/XtraBackup/LATEST/
version:选择最新的版本,可以兼容低版本的数据库
tar -zxvf percona-xtrabackup-2.4.9-Linux-x86_64.tar.gz
cd percona-xtrabackup-2.4.9-Linux-x86_64/bin
./innobackupex --help
[root@localhost bin]# ./innobackupex --help
Open source backup tool for InnoDB and XtraDB
Copyright (C) 2009-2015 Percona LLC and/or its affiliates.
Portions Copyright (C) 2000, 2011, MySQL AB & Innobase Oy. All Rights Reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation version 2
of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You can download full text of the license on http://www.gnu.org/licenses/gpl-2.0.txt
innobackupex - Non-blocking backup tool for InnoDB, XtraDB and HailDB databases
NOTICE: 'innobackupex' is deprecated, please switch to 'xtrabackup'
SYNOPOSIS
innobackupex [--compress] [--compress-threads=NUMBER-OF-THREADS] [--compress-chunk-size=CHUNK-SIZE]
[--encrypt=ENCRYPTION-ALGORITHM] [--encrypt-threads=NUMBER-OF-THREADS] [--encrypt-chunk-size=CHUNK-SIZE]
[--encrypt-key=LITERAL-ENCRYPTION-KEY] | [--encryption-key-file=MY.KEY]
[--include=REGEXP] [--user=NAME]
[--password=WORD] [--port=PORT] [--socket=SOCKET]
[--no-timestamp] [--ibbackup=IBBACKUP-BINARY]
[--slave-info] [--galera-info] [--stream=tar|xbstream]
[--defaults-file=MY.CNF] [--defaults-group=GROUP-NAME]
[--databases=LIST] [--no-lock]
[--tmpdir=DIRECTORY] [--tables-file=FILE]
[--history=NAME]
[--incremental] [--incremental-basedir]
[--incremental-dir] [--incremental-force-scan] [--incremental-lsn]
[--incremental-history-name=NAME] [--incremental-history-uuid=UUID]
[--close-files] [--compact]
BACKUP-ROOT-DIR
innobackupex --apply-log [--use-memory=B]
[--defaults-file=MY.CNF]
[--export] [--redo-only] [--ibbackup=IBBACKUP-BINARY]
BACKUP-DIR
./innobackupex --defaults-file=/etc/my.cnf --no-timestamp --user root --host 192.168.18.111 --password mysql /root/bakup/all-bak
--no-timestamp 可以自己命名备份文件 --defaults-file=/etc/my.cnf --不写会报错
备份成功后
查看文件
[root@localhost all-bak]# ll
total 77888
-rw-r----- 1 root root 424 Sep 12 00:49 backup-my.cnf
-rw-r----- 1 root root 564 Sep 12 00:49 ib_buffer_pool
-rw-r----- 1 root root 79691776 Sep 12 00:49 ibdata1
drwxr-x--- 2 root root 4096 Sep 12 00:49 mysql
drwxr-x--- 2 root root 8192 Sep 12 00:49 performance_schema
drwxr-x--- 2 root root 12288 Sep 12 00:49 prm
drwxr-x--- 2 root root 8192 Sep 12 00:49 sys
-rw-r----- 1 root root 113 Sep 12 00:49 xtrabackup_checkpoints --文件记录备份完成时的lsn(log sequence number和该备份文件的类型.)
-rw-r----- 1 root root 499 Sep 12 00:49 xtrabackup_info
-rw-r----- 1 root root 2560 Sep 12 00:49 xtrabackup_logfile