puser'@'localhost' IDENTIFIED BY 'S3cret2233$';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT RELOAD, LOCK TABLES, PROCESS, REPLICATION CLIENT ON *.* TO 'bkpuser'@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
--设置备份路径
[root@single-instance xtrabackup_dir]# mkdir -p /mysql/xtrabackup_dir/
[root@single-instance xtrabackup_dir]# chown mysql:mysql /mysql/xtrabackup_dir/
[root@single-instance ~]# vi /etc/my.cnf
--添加参数
[xtrabackup]
target_dir = /mysql/xtrabackup_dir/
3、xtrabackup全量备份
--xtrabackup 全量备份
[root@single-instance ~]# xtrabackup --backup --user=bkpuser --password=S3cret2233$
180416 17:38:44 version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup' as 'bkpuser' (using password: YES).
180416 17:38:44 version_check Connected to MySQL server
180416 17:38:44 version_check Executing a version check against the server...
180416 17:38:44 version_check Done.
180416 17:38:44 Connecting to MySQL server host: localhost, user: bkpuser, password: set, port: not set, socket: not set
Using server version 5.7.19-log
xtrabackup version 2.4.10 based on MySQL server 5.7.19 Linux (x86_64) (revision id: 3198bce)
xtrabackup: uses posix_fadvise().
xtrabackup: cd to /var/lib/mysql
xtrabackup: open files limit requested 0, set to 1024
xtrabackup: using the following InnoDB configuration:
xtrabackup: innodb_data_home_dir = .
xtrabackup: innodb_data_file_path = ibdata1:12M:autoextend
xtrabackup: innodb_log_group_home_dir = ./
xtrabackup: innodb_log_files_in_group = 2
xtrabackup: innodb_log_file_size = 50331648
InnoDB: Number of pools: 1
180416 17:38:44 >> log scanned up to (2777824)
xtrabackup: Generating a list of tablespaces
InnoDB: Allocated tablespace ID 54 for flydb/t_list#P#p0, old maximum was 0
180416 17:38:44 [01] Copying ./ibdata1 to /mysql/xtrabackup_dir/ibdata1
180416 17:38:44 [01] ...done
......
180416 17:38:44 [01] Copying ./mysql/slave_worker_info.ibd to /mysql/xtrabackup_dir/mysql/slave_worker_info.ibd
180416 17:38:44 [01] ...done
180416 17:38:45 >> log scanned up to (2777824)
180416 17:38:45 Executing FLUSH NO_WRITE_TO_BINLOG TABLES...
180416 17:38:45 Executing FLUSH TABLES WITH READ LOCK...
180416 17:38:45 Starting to backup non-InnoDB tables and files
180416 17:38:45 [01] Copying ./flydb/t_list.frm to /mysql/xtrabackup_dir/flydb/t_list.frm
180416 17:38:45 [01] ...done
......
180416 17:38:47 [01] Copying ./mysql/help_relation.frm to /mysql/xtrabackup_dir/mysql/help_relation.frm
180416 17:38:47 [01] ...done
180416 17:38:47 Finished backing up non-InnoDB tables and files
180416 17:38:47 [00] Writing /mysql/xtrabackup_dir/xtrabackup_binlog_info
180416 17:38:47 [00] ...done
180416 17:38:47 Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS...
xtrabackup: The latest check point (for incremental): '2777815'
xtrabackup: Stopping log copying thread.
.180416 17:38:47 >> log scanned up to (2777824)
180416 17:38:47 Executing UNLOCK TABLES
180416 17:38:47 All tables unlocked
180416 17:38:47 [00] Copying ib_buffer_pool to /mysql/xtrabackup_dir/ib_buffer_pool
180416 17:38:47 [00] ...done
180416 17:38:47 Backup created in directory '/mysql/xtrabackup_dir/'