赞
踩
使用 XtraBackup 进行增量备份(仅仅备份自上次备份后变更的数据),并使用备份数据进行恢复。
增量备份原理:
1)每个 InnoDB Page 都包含 LSN,LSN 是整个数据库的系统版本号,每个 InnoDB Page 的 LSN 都展示 InnoDB Page 是如何变化的
2)在增量备份时,对比 InnoDB Page 的 LSN 与 全量备份的 LSN,如果 InnoDB Page 的 LSN 较新,则复制该 InnoDB Page
3)更进一步,如果你知道 LSN,则无需基础的全量备份,可以使用 –incremental-lsn 直接指定(但是恢复的时候依旧需要基础的全量备份)
注意事项:
1)该增量备份只能针对 MySQL 实例,而不能针对特定数据库或者特定数据表;
yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm
yum install -y percona-xtrabackup-80.x86_64
增量备份是在全量备份的基础之上,因此需要先创建全量备份:
[root@lys-mysql full]# xtrabackup --host=10.6.8.238 --user=user0001 --password=User0001! --port=3306 --databases="db01" --backup --target-dir=/data/backups/full --no-server-version-check xtrabackup: recognized server arguments: --datadir=/var/lib/mysql xtrabackup: recognized client arguments: --host=10.6.8.238 --user=user0001 --password=* --port=3306 --databases=db01 --backup=1 --target-dir=/data/backups/full --no-server-version-check=1 xtrabackup version 8.0.27-19 based on MySQL server 8.0.27 Linux (x86_64) (revision id: 50dbc8dadda) 220419 09:55:01 version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;host=10.6.8.238;port=3306' as 'user0001' (using password: YES). 220419 09:55:01 version_check Connected to MySQL server 220419 09:55:01 version_check Executing a version check against the server... 220419 09:55:01 version_check Done. 220419 09:55:01 Connecting to MySQL server host: 10.6.8.238, user: user0001, password: set, port: 3306, socket: not set Using server version 8.0.28 220419 09:55:01 Executing LOCK INSTANCE FOR BACKUP... xtrabackup: uses posix_fadvise(). xtrabackup: cd to /var/lib/mysql xtrabackup: open files limit requested 0, set to 1048576 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 Number of pools: 1 xtrabackup: inititialize_service_handles suceeded 220419 09:55:02 Connecting to MySQL server host: 10.6.8.238, user: user0001, password: set, port: 3306, socket: not set xtrabackup: Redo Log Archiving is not set up. 220419 09:55:02 >> log scanned up to (18611669) xtrabackup: Generating a list of tablespaces xtrabackup: Generating a list of tablespaces Scanning './' Completed space ID check of 2 files. Allocated tablespace ID 18 for db01/tb_user, old maximum was 0 Using undo tablespace './undo_001'. Using undo tablespace './undo_002'. Opened 2 existing undo tablespaces. 220419 09:55:02 [01] Copying ./ibdata1 to /data/backups/full/ibdata1 220419 09:55:02 [01] ...done 220419 09:55:02 [01] Copying ./db01/tb_user.ibd to /data/backups/full/db01/tb_user.ibd 220419 09:55:02 [01] ...done 220419 09:55:02 [01] Copying ./db01/tb_user_copy1.ibd to /data/backups/full/db01/tb_user_copy1.ibd 220419 09:55:02 [01] ...done 220419 09:55:02 [01] Copying ./mysql.ibd to /data/backups/full/mysql.ibd 220419 09:55:02 [01] ...done 220419 09:55:02 [01] Copying ./undo_002 to /data/backups/full/undo_002 220419 09:55:03 [01] ...done 220419 09:55:03 [01] Copying ./undo_001 to /data/backups/full/undo_001 220419 09:55:03 [01] ...done 220419 09:55:03 >> log scanned up to (18611669) 220419 09:55:03 Starting to backup non-InnoDB tables and files 220419 09:55:03 [01] Skipping ./auto.cnf. 220419 09:55:03 [01] Skipping ./ibdata1. 220419 09:55:03 [01] Skipping ./ib_logfile1. 220419 09:55:03 [01] Skipping ./#ib_16384_0.dblwr. 220419 09:55:03 [01] Skipping ./#ib_16384_1.dblwr. 220419 09:55:03 [01] Skipping ./undo_001. 220419 09:55:03 [01] Skipping ./undo_002. 220419 09:55:03 [01] Skipping ./ib_logfile0. 220419 09:55:03 [01] Skipping ./mysql.ibd. 220419 09:55:03 [01] Skipping ./ca-key.pem. 220419 09:55:03 [01] Skipping ./ca.pem. 220419 09:55:03 [01] Skipping ./server-key.pem. 220419 09:55:03 [01] Skipping ./server-cert.pem. 220419 09:55:03 [01] Skipping ./client-key.pem. 220419 09:55:03 [01] Skipping ./client-cert.pem. 220419 09:55:03 [01] Skipping ./private_key.pem. 220419 09:55:03 [01] Skipping ./public_key.pem. 220419 09:55:03 [01] Skipping ./ib_buffer_pool. 220419 09:55:03 [01] Skipping ./ibtmp1. 220419 09:55:03 [01] Skipping ./binlog.000001. 220419 09:55:03 [01] Skipping ./mysql.sock.lock. 220419 09:55:03 [01] Skipping ./lys_bin.txt. 220419 09:55:03 [01] Skipping ./binlog.000002. 220419 09:55:03 [01] Skipping ./binlog.000003. 220419 09:55:03 [01] Skipping ./binlog.000004. 220419 09:55:03 [01] Skipping ./binlog.000005. 220419 09:55:03 [01] Skipping ./binlog.000006. 220419 09:55:03 [01] Skipping ./binlog.000007. 220419 09:55:03 [01] Skipping ./binlog.index. 220419 09:55:03 Finished backing up non-InnoDB tables and files 220419 09:55:03 Executing FLUSH NO_WRITE_TO_BINLOG BINARY LOGS 220419 09:55:03 Selecting LSN and binary log position from p_s.log_status 220419 09:55:03 [00] Copying /var/lib/mysql/binlog.000008 to /data/backups/full/binlog.000008 up to position 157 220419 09:55:03 [00] ...done 220419 09:55:03 [00] Writing /data/backups/full/binlog.index 220419 09:55:03 [00] ...done 220419 09:55:03 [00] Writing /data/backups/full/xtrabackup_binlog_info 220419 09:55:03 [00] ...done 220419 09:55:03 Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS... xtrabackup: The latest check point (for incremental): '18611669' xtrabackup: Stopping log copying thread at LSN 18611669. Starting to parse redo log at lsn = 18611226 220419 09:55:03 Executing UNLOCK INSTANCE 220419 09:55:03 All tables unlocked 220419 09:55:03 [00] Copying ib_buffer_pool to /data/backups/full/ib_buffer_pool 220419 09:55:03 [00] ...done 220419 09:55:03 Backup created in directory '/data/backups/full/' MySQL binlog position: filename 'binlog.000008', position '157' 220419 09:55:03 [00] Writing /data/backups/full/backup-my.cnf 220419 09:55:03 [00] ...done 220419 09:55:03 [00] Writing /data/backups/full/xtrabackup_info 220419 09:55:03 [00] ...done xtrabackup: Transaction log of lsn (18611669) to (18611679) was copied. 220419 09:55:05 completed OK!
查看 xtrabackup_checkpoints 文件可以获取 LSN 相关信息。
[root@lys-mysql full]# cat xtrabackup_checkpoints
backup_type = full-backuped
from_lsn = 0
to_lsn = 18611669
last_lsn = 18611669
flushed_lsn = 18611669
[root@lys-mysql inc1]# xtrabackup --no-server-version-check --backup --host=10.6.8.238 --user=user0001 --password=User0001! --port=3306 --databases="db01" --target-dir=/data/backups/inc1 --incremental-basedir=/data/backups/full xtrabackup: recognized server arguments: --datadir=/var/lib/mysql xtrabackup: recognized client arguments: --no-server-version-check=1 --backup=1 --host=10.6.8.238 --user=user0001 --password=* --port=3306 --databases=db01 --target-dir=/data/backups/inc1 --incremental-basedir=/data/backups/full xtrabackup version 8.0.27-19 based on MySQL server 8.0.27 Linux (x86_64) (revision id: 50dbc8dadda) 220419 10:00:44 version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;host=10.6.8.238;port=3306' as 'user0001' (using password: YES). 220419 10:00:44 version_check Connected to MySQL server 220419 10:00:44 version_check Executing a version check against the server... 220419 10:00:44 version_check Done. 220419 10:00:44 Connecting to MySQL server host: 10.6.8.238, user: user0001, password: set, port: 3306, socket: not set Using server version 8.0.28 220419 10:00:44 Executing LOCK INSTANCE FOR BACKUP... incremental backup from 18611669 is enabled. xtrabackup: uses posix_fadvise(). xtrabackup: cd to /var/lib/mysql xtrabackup: open files limit requested 0, set to 1048576 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 Number of pools: 1 xtrabackup: inititialize_service_handles suceeded 220419 10:00:44 Connecting to MySQL server host: 10.6.8.238, user: user0001, password: set, port: 3306, socket: not set xtrabackup: Redo Log Archiving is not set up. 220419 10:00:45 >> log scanned up to (18612011) xtrabackup: Generating a list of tablespaces xtrabackup: Generating a list of tablespaces Scanning './' Completed space ID check of 2 files. Allocated tablespace ID 18 for db01/tb_user, old maximum was 0 Using undo tablespace './undo_001'. Using undo tablespace './undo_002'. Opened 2 existing undo tablespaces. xtrabackup: using the full scan for incremental backup 220419 10:00:45 [01] Copying ./ibdata1 to /data/backups/inc1/ibdata1.delta 220419 10:00:45 [01] ...done 220419 10:00:45 [01] Copying ./db01/tb_user.ibd to /data/backups/inc1/db01/tb_user.ibd.delta 220419 10:00:45 [01] ...done 220419 10:00:45 [01] Copying ./db01/tb_user_copy1.ibd to /data/backups/inc1/db01/tb_user_copy1.ibd.delta 220419 10:00:45 [01] ...done 220419 10:00:45 [01] Copying ./mysql.ibd to /data/backups/inc1/mysql.ibd.delta 220419 10:00:46 [01] ...done 220419 10:00:46 >> log scanned up to (18612011) 220419 10:00:46 [01] Copying ./undo_002 to /data/backups/inc1/undo_002.delta 220419 10:00:46 [01] ...done 220419 10:00:46 [01] Copying ./undo_001 to /data/backups/inc1/undo_001.delta 220419 10:00:46 [01] ...done 220419 10:00:47 >> log scanned up to (18612011) 220419 10:00:47 Starting to backup non-InnoDB tables and files 220419 10:00:47 [01] Skipping ./auto.cnf. 220419 10:00:47 [01] Skipping ./ibdata1. 220419 10:00:47 [01] Skipping ./ib_logfile1. 220419 10:00:47 [01] Skipping ./#ib_16384_0.dblwr. 220419 10:00:47 [01] Skipping ./#ib_16384_1.dblwr. 220419 10:00:47 [01] Skipping ./undo_001. 220419 10:00:47 [01] Skipping ./undo_002. 220419 10:00:47 [01] Skipping ./ib_logfile0. 220419 10:00:47 [01] Skipping ./mysql.ibd. 220419 10:00:47 [01] Skipping ./ca-key.pem. 220419 10:00:47 [01] Skipping ./ca.pem. 220419 10:00:47 [01] Skipping ./server-key.pem. 220419 10:00:47 [01] Skipping ./server-cert.pem. 220419 10:00:47 [01] Skipping ./client-key.pem. 220419 10:00:47 [01] Skipping ./client-cert.pem. 220419 10:00:47 [01] Skipping ./private_key.pem. 220419 10:00:47 [01] Skipping ./public_key.pem. 220419 10:00:47 [01] Skipping ./ib_buffer_pool. 220419 10:00:47 [01] Skipping ./ibtmp1. 220419 10:00:47 [01] Skipping ./binlog.000001. 220419 10:00:47 [01] Skipping ./mysql.sock.lock. 220419 10:00:47 [01] Skipping ./lys_bin.txt. 220419 10:00:47 [01] Skipping ./binlog.000002. 220419 10:00:47 [01] Skipping ./binlog.000003. 220419 10:00:47 [01] Skipping ./binlog.000004. 220419 10:00:47 [01] Skipping ./binlog.000005. 220419 10:00:47 [01] Skipping ./binlog.000006. 220419 10:00:47 [01] Skipping ./binlog.000007. 220419 10:00:47 [01] Skipping ./binlog.000008. 220419 10:00:47 [01] Skipping ./binlog.000009. 220419 10:00:47 [01] Skipping ./binlog.index. 220419 10:00:47 Finished backing up non-InnoDB tables and files 220419 10:00:47 Executing FLUSH NO_WRITE_TO_BINLOG BINARY LOGS 220419 10:00:47 Selecting LSN and binary log position from p_s.log_status 220419 10:00:47 [00] Copying /var/lib/mysql/binlog.000010 to /data/backups/inc1/binlog.000010 up to position 157 220419 10:00:47 [00] ...done 220419 10:00:47 [00] Writing /data/backups/inc1/binlog.index 220419 10:00:47 [00] ...done 220419 10:00:47 [00] Writing /data/backups/inc1/xtrabackup_binlog_info 220419 10:00:47 [00] ...done 220419 10:00:47 Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS... xtrabackup: The latest check point (for incremental): '18612011' xtrabackup: Stopping log copying thread at LSN 18612011. Starting to parse redo log at lsn = 18611725 220419 10:00:47 Executing UNLOCK INSTANCE 220419 10:00:47 All tables unlocked 220419 10:00:47 [00] Copying ib_buffer_pool to /data/backups/inc1/ib_buffer_pool 220419 10:00:47 [00] ...done 220419 10:00:47 Backup created in directory '/data/backups/inc1/' MySQL binlog position: filename 'binlog.000010', position '157' 220419 10:00:47 [00] Writing /data/backups/inc1/backup-my.cnf 220419 10:00:47 [00] ...done 220419 10:00:47 [00] Writing /data/backups/inc1/xtrabackup_info 220419 10:00:47 [00] ...done xtrabackup: Transaction log of lsn (18612011) to (18612021) was copied. 220419 10:00:48 completed OK!
查看 xtrabackup_checkpoints 文件可以获取 LSN 相关信息。
[root@lys-mysql inc1]# cat xtrabackup_checkpoints
backup_type = incremental
from_lsn = 18611669
to_lsn = 18612011
last_lsn = 18612011
flushed_lsn = 18612011
增量备份的准备阶段不同与全量备份的准备阶段:
对于全量备份,在准备阶段中,需要:将已提交事务从日志文件写入数据文件;回滚未提交的事务;
对于增量备份,在准备阶段中,不能回滚未提交的事务,因为事务可能在下次备份中提价;
因此对全量备份使用 xtrabackup –apply-log-only 应用日志,防止发生回滚,否则全量备份无法用于增量备份。
此时的全量备份可以用于数据恢复,因为未提交的事务会在启动时被 MySQL 处理。首先对全量备份应用日志,以作为增量的基础:
[root@lys-mysql full]# xtrabackup --no-server-version-check --prepare --apply-log-only --host=10.6.8.238 --user=user0001 --password=User0001! --port=3306 --databases="db01" --target-dir=/data/backups/full xtrabackup: recognized server arguments: --innodb_checksum_algorithm=crc32 --innodb_log_checksums=1 --innodb_data_file_path=ibdata1:12M:autoextend --innodb_log_files_in_group=2 --innodb_log_file_size=50331648 --innodb_page_size=16384 --innodb_undo_directory=./ --innodb_undo_tablespaces=2 --server-id=0 --innodb_log_checksums=ON --innodb_redo_log_encrypt=0 --innodb_undo_log_encrypt=0 xtrabackup: recognized client arguments: --no-server-version-check=1 --prepare=1 --apply-log-only=1 --host=10.6.8.238 --user=user0001 --password=* --port=3306 --databases=db01 --target-dir=/data/backups/full xtrabackup version 8.0.27-19 based on MySQL server 8.0.27 Linux (x86_64) (revision id: 50dbc8dadda) xtrabackup: cd to /data/backups/full/ xtrabackup: This target seems to be not prepared yet. Number of pools: 1 xtrabackup: xtrabackup_logfile detected: size=8388608, start_lsn=(18611669) xtrabackup: using the following InnoDB configuration for recovery: 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 = 1 xtrabackup: innodb_log_file_size = 8388608 xtrabackup: inititialize_service_handles suceeded xtrabackup: using the following InnoDB configuration for recovery: 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 = 1 xtrabackup: innodb_log_file_size = 8388608 xtrabackup: Starting InnoDB instance for recovery. xtrabackup: Using 104857600 bytes for buffer pool (set by --use-memory parameter) PUNCH HOLE support available Uses event mutexes GCC builtin __atomic_thread_fence() is used for memory barrier Compressed tables use zlib 1.2.11 Number of pools: 1 Using hardware accelerated crc32 and polynomial multiplication. Directories to scan './' Scanning './' Completed space ID check of 5 files. Initializing buffer pool, total size = 128.000000M, instances = 1, chunk size =128.000000M Completed initialization of buffer pool page_cleaner coordinator priority: -20 page_cleaner worker priority: -20 page_cleaner worker priority: -20 page_cleaner worker priority: -20 The log sequence number 17790438 in the system tablespace does not match the log sequence number 18611669 in the ib_logfiles! Database was not shutdown normally! Starting crash recovery. Starting to parse redo log at lsn = 18611226, whereas checkpoint_lsn = 18611669 and start_lsn = 18611200 Doing recovery: scanned up to log sequence number 18611669 Log background threads are being started... Applying a batch of 0 redo log records ... Apply batch completed! Using undo tablespace './undo_001'. Using undo tablespace './undo_002'. Opened 2 existing undo tablespaces. GTID recovery trx_no: 1695 Parallel initialization of rseg complete Time taken to initialize rseg using 2 thread: 648843 ms. Creating shared tablespace for temporary tables Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... File './ibtmp1' size is now 12 MB. Scanning temp tablespace dir:'./#innodb_temp/' Created 128 and tracked 128 new rollback segment(s) in the temporary tablespace. 128 are now active. 8.0.27 started; log sequence number 18611679 Allocated tablespace ID 18 for db01/tb_user, old maximum was 0 xtrabackup: starting shutdown with innodb_fast_shutdown = 1 FTS optimize thread exiting. Starting shutdown... Log background threads are being closed... Shutdown completed; log sequence number 18611679 Number of pools: 1 220420 01:18:44 completed OK!
最后新的备份数据位于/data/backups/full 目录,即该目录数据已经被修改,不再是原先的全量备份。
注意事项,增量备份目录(/data/backups/inc1)只能使用一次,如果以后会再次使用,需要先将其备份。
[root@lys-mysql full]# xtrabackup --no-server-version-check --prepare --apply-log-only --host=10.6.8.238 --user=user0001 --password=User0001! --port=3306 --databases="db01" --target-dir=/data/backups/full --incremental-dir=/data/backups/inc1 xtrabackup: recognized server arguments: --innodb_checksum_algorithm=crc32 --innodb_log_checksums=1 --innodb_data_file_path=ibdata1:12M:autoextend --innodb_log_files_in_group=2 --innodb_log_file_size=50331648 --innodb_page_size=16384 --innodb_undo_directory=./ --innodb_undo_tablespaces=2 --server-id=0 --innodb_log_checksums=ON --innodb_redo_log_encrypt=0 --innodb_undo_log_encrypt=0 xtrabackup: recognized client arguments: --no-server-version-check=1 --prepare=1 --apply-log-only=1 --host=10.6.8.238 --user=user0001 --password=* --port=3306 --databases=db01 --target-dir=/data/backups/full --incremental-dir=/data/backups/inc1 xtrabackup version 8.0.27-19 based on MySQL server 8.0.27 Linux (x86_64) (revision id: 50dbc8dadda) incremental backup from 18611669 is enabled. xtrabackup: cd to /data/backups/full/ xtrabackup: This target seems to be already prepared with --apply-log-only. Number of pools: 1 xtrabackup: xtrabackup_logfile detected: size=8388608, start_lsn=(18612011) xtrabackup: using the following InnoDB configuration for recovery: xtrabackup: innodb_data_home_dir = . xtrabackup: innodb_data_file_path = ibdata1:12M:autoextend xtrabackup: innodb_log_group_home_dir = /data/backups/inc1/ xtrabackup: innodb_log_files_in_group = 1 xtrabackup: innodb_log_file_size = 8388608 xtrabackup: inititialize_service_handles suceeded xtrabackup: Generating a list of tablespaces xtrabackup: Generating a list of tablespaces Scanning './' Completed space ID check of 2 files. Allocated tablespace ID 18 for db01/tb_user, old maximum was 0 Using undo tablespace './undo_001'. Using undo tablespace './undo_002'. Opened 2 existing undo tablespaces. xtrabackup: page size for /data/backups/inc1//ibdata1.delta is 16384 bytes Applying /data/backups/inc1//ibdata1.delta to ./ibdata1... xtrabackup: page size for /data/backups/inc1//db01/tb_user.ibd.delta is 16384 bytes Applying /data/backups/inc1//db01/tb_user.ibd.delta to ./db01/tb_user.ibd... xtrabackup: page size for /data/backups/inc1//db01/tb_user_copy1.ibd.delta is 16384 bytes Applying /data/backups/inc1//db01/tb_user_copy1.ibd.delta to ./db01/tb_user_copy1.ibd... xtrabackup: page size for /data/backups/inc1//mysql.ibd.delta is 16384 bytes Applying /data/backups/inc1//mysql.ibd.delta to ./mysql.ibd... xtrabackup: page size for /data/backups/inc1//undo_002.delta is 16384 bytes Applying /data/backups/inc1//undo_002.delta to ./undo_002... xtrabackup: page size for /data/backups/inc1//undo_001.delta is 16384 bytes Applying /data/backups/inc1//undo_001.delta to ./undo_001... xtrabackup: using the following InnoDB configuration for recovery: xtrabackup: innodb_data_home_dir = . xtrabackup: innodb_data_file_path = ibdata1:12M:autoextend xtrabackup: innodb_log_group_home_dir = /data/backups/inc1/ xtrabackup: innodb_log_files_in_group = 1 xtrabackup: innodb_log_file_size = 8388608 xtrabackup: Starting InnoDB instance for recovery. xtrabackup: Using 104857600 bytes for buffer pool (set by --use-memory parameter) PUNCH HOLE support available Uses event mutexes GCC builtin __atomic_thread_fence() is used for memory barrier Compressed tables use zlib 1.2.11 Number of pools: 1 Using hardware accelerated crc32 and polynomial multiplication. Directories to scan './' Scanning './' Completed space ID check of 5 files. Initializing buffer pool, total size = 128.000000M, instances = 1, chunk size =128.000000M Completed initialization of buffer pool page_cleaner coordinator priority: -20 page_cleaner worker priority: -20 page_cleaner worker priority: -20 page_cleaner worker priority: -20 The log sequence number 18611679 in the system tablespace does not match the log sequence number 18612011 in the ib_logfiles! Database was not shutdown normally! Starting crash recovery. Starting to parse redo log at lsn = 18611725, whereas checkpoint_lsn = 18612011 and start_lsn = 18611712 Doing recovery: scanned up to log sequence number 18612011 Log background threads are being started... Applying a batch of 0 redo log records ... Apply batch completed! Using undo tablespace './undo_001'. Using undo tablespace './undo_002'. Opened 2 existing undo tablespaces. GTID recovery trx_no: 1700 Parallel initialization of rseg complete Time taken to initialize rseg using 2 thread: 491856 ms. Removed temporary tablespace data file: "ibtmp1" Creating shared tablespace for temporary tables Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... File './ibtmp1' size is now 12 MB. Scanning temp tablespace dir:'./#innodb_temp/' Created 128 and tracked 128 new rollback segment(s) in the temporary tablespace. 128 are now active. 8.0.27 started; log sequence number 18612021 Allocated tablespace ID 18 for db01/tb_user, old maximum was 0 xtrabackup: starting shutdown with innodb_fast_shutdown = 1 FTS optimize thread exiting. Starting shutdown... Log background threads are being closed... Shutdown completed; log sequence number 18612021 Number of pools: 1 220420 01:22:49 [00] Copying /data/backups/inc1//xtrabackup_binlog_info to ./xtrabackup_binlog_info 220420 01:22:49 [00] ...done 220420 01:22:49 [00] Copying /data/backups/inc1//xtrabackup_info to ./xtrabackup_info 220420 01:22:49 [00] ...done 220420 01:22:49 [00] Copying /data/backups/inc1//xtrabackup_tablespaces to ./xtrabackup_tablespaces 220420 01:22:49 [00] ...done 220420 01:22:49 [00] Copying /data/backups/inc1/binlog.000010 to ./binlog.000010 220420 01:22:49 [00] ...done 220420 01:22:49 [00] Copying /data/backups/inc1/binlog.index to ./binlog.index 220420 01:22:49 [00] ...done 220420 01:22:49 completed OK!
1)最后可将 /data/backups/base/ 内容复制到数据库目录;
2)修改数据库文件权限及所有者/组;
3)启动数据库服务,并检查数据库服务是否正常;
https://docs.percona.com/percona-xtrabackup/latest/installation/yum_repo.html
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。