【MySQL】ERROR 1872 (HY000): Slave failed to initialize relay log info structure from the repository

1.mysqlbackup 软件做全备 

mysqlbackup --defaults-file=/etc/my.cnf --user=root \
--password=rootroot --backup-image=/mysql/backup/backup-db/fullbackup`date +%Y%m%d`.mbi \
--with-timestamp backup-to-image --backup-dir=/mysql/backup/backup-tmp

[root@mysql1 backup]# mysqlbackup --defaults-file=/etc/my.cnf --user=root \
> --password=rootroot --backup-image=/mysql/backup/backup-db/fullbackup`date +%Y%m%d`.mbi \
> --with-timestamp backup-to-image --backup-dir=/mysql/backup/backup-tmp 
MySQL Enterprise Backup version 4.1.1 Linux-4.1.12-37.4.1.el6uek.x86_64-x86_64 [2018/04/24 08:26:22] 
Copyright (c) 2003, 2018, Oracle and/or its affiliates. All Rights Reserved.
[Build ID : 12942442.c465cfd7261c781502aec204494abf138f9d59e6]

240801 17:33:22 MAIN    INFO: A thread created with Id '140477632190272' 
240801 17:33:22 MAIN    INFO: Starting with following command line ...
 mysqlbackup --defaults-file=/etc/my.cnf --user=root --password=xxxxxxxx 
        --backup-image=/mysql/backup/backup-db/fullbackup20240801.mbi 
        --with-timestamp backup-to-image --backup-dir=/mysql/backup/backup-tmp 

240801 17:33:22 MAIN    INFO: 
240801 17:33:22 MAIN    INFO: Not using SSL.
240801 17:33:22 MAIN    INFO: MySQL server version is '5.7.34-log'
240801 17:33:22 MAIN    INFO: MySQL server compile os version is 'Linux'
240801 17:33:22 MAIN    INFO: Got some server configuration information from running server.

240801 17:33:22 MAIN    INFO: Server system variable 'old_alter_table' was set to '0'. Setting it to '1'.
IMPORTANT: Please check that mysqlbackup run completes successfully.
           At the end of a successful 'backup-to-image' run mysqlbackup
           prints "mysqlbackup completed OK!".

240801 17:33:22 MAIN    INFO: 0 active keyring plugins found.
240801 17:33:22 MAIN    INFO: KEF target path:'/mysql/backup/backup-tmp/2024-08-01_17-33-22/meta/keyring_kef'
240801 17:33:22 MAIN    INFO: TDE Keyring service initialized.
240801 17:33:22 MAIN    INFO: MEB logfile created at /mysql/backup/backup-tmp/2024-08-01_17-33-22/meta/MEB_2024-08-01.17-33-22_image_backup.log

--------------------------------------------------------------------
                       Server Repository Options:
--------------------------------------------------------------------
  datadir                        = /data/mysql/data/
  innodb_data_home_dir           = 
  innodb_data_file_path          = ibdata:1G:autoextend
  innodb_log_group_home_dir      = /data/mysql/data/
  innodb_log_files_in_group      = 2
  innodb_log_file_size           = 268435456
  innodb_undo_directory          = /data/mysql/data/
  innodb_undo_tablespaces        = 0
  innodb_undo_logs               = 128
  innodb_buffer_pool_filename    = ib_buffer_pool
  innodb_page_size               = 16384
  innodb_checksum_algorithm      = crc32

--------------------------------------------------------------------
                       Backup Config Options:
--------------------------------------------------------------------
  datadir                        = /mysql/backup/backup-tmp/2024-08-01_17-33-22/datadir
  innodb_data_home_dir           = /mysql/backup/backup-tmp/2024-08-01_17-33-22/datadir
  innodb_data_file_path          = ibdata:1G:autoextend
  innodb_log_group_home_dir      = /mysql/backup/backup-tmp/2024-08-01_17-33-22/datadir
  innodb_log_files_in_group      = 2
  innodb_log_file_size           = 268435456
  innodb_undo_directory          = /mysql/backup/backup-tmp/2024-08-01_17-33-22/datadir
  innodb_undo_tablespaces        = 0
  innodb_undo_logs               = 128
  innodb_buffer_pool_filename    = ib_buffer_pool
  innodb_page_size               = 16384
  innodb_checksum_algorithm      = crc32

Backup Image Path = /mysql/backup/backup-db/fullbackup20240801.mbi
240801 17:33:22 MAIN    INFO: Unique generated backup id for this is 17225048022150388

240801 17:33:22 MAIN    INFO: Creating 14 buffers each of size 16777216.
240801 17:33:22 MAIN    INFO: Full Image Backup operation starts with following threads
		1 read-threads    6 process-threads    1 write-threads
240801 17:33:22 MAIN    INFO: Found checkpoint at lsn 4798413594.
240801 17:33:22 MAIN    INFO: Starting log scan from lsn = 4798413312 at offset = 235038720 and checkpoint = 4798413594 in file /data/mysql/data/ib_logfile1.
240801 17:33:22 RLP1    INFO: A thread created with Id '140477163636480' 
240801 17:33:22 PCR5    INFO: A thread created with Id '140477205600000' 
240801 17:33:22 PCR6    INFO: A thread created with Id '140477197207296' 
240801 17:33:22 PCR1    INFO: A thread created with Id '140477239170816' 
240801 17:33:22 PCR2    INFO: A thread created with Id '140477230778112' 
240801 17:33:22 PCR3    INFO: A thread created with Id '140477222385408' 
240801 17:33:22 WTR1    INFO: A thread created with Id '140477188814592' 
240801 17:33:22 RLR1    INFO: A thread created with Id '140477180421888' 
240801 17:33:22 RLW1    INFO: A thread created with Id '140477172029184' 
240801 17:33:22 PCR4    INFO: A thread created with Id '140477213992704' 
240801 17:33:22 RDR1    INFO: A thread created with Id '140477247563520' 
240801 17:33:22 RDR1    INFO: Copying meta file /mysql/backup/backup-tmp/2024-08-01_17-33-22/backup-my.cnf.
240801 17:33:22 RDR1    INFO: Copying meta file /mysql/backup/backup-tmp/2024-08-01_17-33-22/meta/backup_create.xml.
240801 17:33:22 RDR1    INFO: System tablespace file format is Antelope.
240801 17:33:22 RDR1    INFO: Starting to copy all innodb files...
240801 17:33:22 RDR1    INFO: Copying /data/mysql/data/ibdata (Barracuda file format).
240801 17:33:23 RDR1 Progress in MB: 200 400 600 800 1000 
240801 17:33:26 RDR1    INFO: Copying /data/mysql/data/itpuxdb1/itpuxbak11.ibd (Barracuda file format).
240801 17:33:26 RDR1    INFO: Copying /data/mysql/data/itpuxdb2/itpuxbak21.ibd (Barracuda file format).
240801 17:33:26 RDR1    INFO: Copying /data/mysql/data/mysql/engine_cost.ibd (Barracuda file format).
240801 17:33:26 RDR1    INFO: Copying /data/mysql/data/mysql/gtid_executed.ibd (Barracuda file format).
240801 17:33:26 RDR1    INFO: Copying /data/mysql/data/mysql/help_category.ibd (Barracuda file format).
240801 17:33:27 RDR1    INFO: Copying /data/mysql/data/mysql/help_keyword.ibd (Barracuda file format).
240801 17:33:27 RDR1    INFO: Copying /data/mysql/data/mysql/help_relation.ibd (Barracuda file format).
240801 17:33:27 RDR1    INFO: Copying /data/mysql/data/mysql/help_topic.ibd (Barracuda file format).
240801 17:33:27 RDR1    INFO: Copying /data/mysql/data/mysql/innodb_index_stats.ibd (Barracuda file format).
240801 17:33:27 RDR1    INFO: Copying /data/mysql/data/mysql/innodb_table_stats.ibd (Barracuda file format).
240801 17:33:27 RDR1    INFO: Copying /data/mysql/data/mysql/plugin.ibd (Barracuda file format).
240801 17:33:27 RDR1    INFO: Copying /data/mysql/data/mysql/server_cost.ibd (Barracuda file format).
240801 17:33:27 RDR1    INFO: Copying /data/mysql/data/mysql/servers.ibd (Barracuda file format).
240801 17:33:27 RDR1    INFO: Copying /data/mysql/data/mysql/slave_master_info.ibd (Barracuda file format).
240801 17:33:27 RDR1    INFO: Copying /data/mysql/data/mysql/slave_relay_log_info.ibd (Barracuda file format).
240801 17:33:27 RDR1    INFO: Copying /data/mysql/data/mysql/slave_worker_info.ibd (Barracuda file format).
240801 17:33:27 RDR1    INFO: Copying /data/mysql/data/mysql/time_zone.ibd (Barracuda file format).
240801 17:33:27 RDR1    INFO: Copying /data/mysql/data/mysql/time_zone_leap_second.ibd (Barracuda file format).
240801 17:33:27 RDR1    INFO: Copying /data/mysql/data/mysql/time_zone_name.ibd (Barracuda file format).
240801 17:33:27 RDR1    INFO: Copying /data/mysql/data/mysql/time_zone_transition.ibd (Barracuda file format).
240801 17:33:27 RDR1    INFO: Copying /data/mysql/data/mysql/time_zone_transition_type.ibd (Barracuda file format).
240801 17:33:27 RDR1    INFO: Copying /data/mysql/data/sys/sys_config.ibd (Barracuda file format).
240801 17:33:27 RDR1    INFO: Copying /data/mysql/data/test/test1.ibd (Barracuda file format).
240801 17:33:28 RDR1 Progress in MB: 1200 1400 1600 1800 2000 2200 2400 2600 2800 3000 3200 3400 
240801 17:33:42 RDR1    INFO: Completing the copy of innodb files.
240801 17:33:42 RDR1    INFO: Requesting a dump of the InnoDB buffer pool
240801 17:33:42 RDR1    INFO: Waiting for the dump of the InnoDB buffer pool to complete
240801 17:33:42 RDR1    INFO: The dump of the InnoDB buffer pool completed
240801 17:33:42 RDR1 Progress in MB: 3600 
240801 17:33:42 RDR1    INFO: Starting to copy Binlog files...
240801 17:33:42 RDR1    INFO: Copying /data/mysql/data/mybinlog.000014.
240801 17:33:42 RDR1    INFO: Copying /data/mysql/data/mybinlog.000015.
240801 17:33:42 RDR1    INFO: Copying /data/mysql/data/mybinlog.000016.
240801 17:33:42 RDR1    INFO: Copying /data/mysql/data/mybinlog.000017.
240801 17:33:42 RDR1    INFO: Copying /data/mysql/data/mybinlog.000018.
240801 17:33:42 RDR1    INFO: Copying /data/mysql/data/mysql1-relay-bin.000001.
240801 17:33:42 RDR1    INFO: Copying /data/mysql/data/mysql1-relay-bin.000002.
240801 17:33:42 RDR1    INFO: Copying /data/mysql/data/mysql1-relay-bin.000003.
240801 17:33:42 RDR1    INFO: Copying /data/mysql/data/mysql1-relay-bin.000004.
240801 17:33:42 RDR1    INFO: Preparing to lock tables: Connected to mysqld server.
240801 17:33:42 RDR1    INFO: Starting to lock all the tables...
240801 17:33:42 RDR1    INFO: Flushing the default MyISAM key cache.
240801 17:33:42 RDR1    INFO: All tables are locked and flushed to disk
240801 17:33:42 RDR1    INFO: Copying /data/mysql/data/mybinlog.000019.
240801 17:33:42 RDR1    INFO: Copying /data/mysql/data/mysql1-relay-bin.000005.
240801 17:33:42 RDR1    INFO: Completed the copy of binlog files...
240801 17:33:42 RDR1    INFO: Opening backup source directory '/data/mysql/data'
240801 17:33:42 RDR1    INFO: Starting to backup all non-innodb files  in 
	subdirectories of '/data/mysql/data'
240801 17:33:42 WTR1    INFO: Adding database directory: datadir/itpuxdb1
240801 17:33:42 WTR1    INFO: Adding database directory: datadir/itpuxdb2
240801 17:33:42 WTR1    INFO: Adding database directory: datadir/mysql
240801 17:33:42 WTR1    INFO: Adding database directory: datadir/performance_schema
240801 17:33:43 WTR1    INFO: Adding database directory: datadir/sys
240801 17:33:43 RDR1    INFO: Completing the copy of all non-innodb files.
240801 17:33:43 WTR1    INFO: Adding database directory: datadir/test
240801 17:33:43 RDR1    INFO: Requesting completion of redo log copy. Rapid: 0
240801 17:33:43 RLR1    INFO: Signaled '1' to complete log copy.
240801 17:33:43 RLR1    INFO: Signaled '1' to complete log copy.
240801 17:33:43 RLR1    INFO: Signaled '1' to complete log copy.
240801 17:33:43 RLR1    INFO: Redo log reader waited = 20270.00 ms for logs to generate.
240801 17:33:43 RLW1    INFO: A copied database page was modified at 4798413594.
          (This is the highest lsn found on page)
          Scanned log up to lsn 4798413603.
          Was able to parse the log up to lsn 4798413603.
240801 17:33:44 RDR1    INFO: All tables unlocked
240801 17:33:44 RDR1    INFO: All MySQL tables were locked for 1.213 seconds.
240801 17:33:44 RDR1    INFO: Setting server system variable 'old_alter_table' back to '0'.
240801 17:33:44 RDR1    INFO: Reading all global variables from the server.
240801 17:33:44 RDR1    INFO: Completed reading of all global variables from the server.
240801 17:33:44 RDR1    INFO: Writing config file for server '5.7.34-log'.
240801 17:33:44 RDR1    INFO: Creating server config files server-my.cnf and server-all.cnf in /mysql/backup/backup-tmp/2024-08-01_17-33-22
240801 17:33:44 RDR1    INFO: Copying meta file /mysql/backup/backup-tmp/2024-08-01_17-33-22/meta/backup_variables.txt.
240801 17:33:44 RDR1    INFO: Copying meta file /mysql/backup/backup-tmp/2024-08-01_17-33-22/datadir/ibbackup_logfile.
240801 17:33:44 RDR1    INFO: Copying meta file /mysql/backup/backup-tmp/2024-08-01_17-33-22/server-all.cnf.
240801 17:33:44 RDR1    INFO: Copying meta file /mysql/backup/backup-tmp/2024-08-01_17-33-22/server-my.cnf.
240801 17:33:44 RDR1    INFO: Copying meta file /mysql/backup/backup-tmp/2024-08-01_17-33-22/meta/backup_gtid_executed.sql.
240801 17:33:44 RDR1    INFO: Copying meta file /mysql/backup/backup-tmp/2024-08-01_17-33-22/meta/backup_content.xml.
240801 17:33:44 RDR1    INFO: Copying meta file /mysql/backup/backup-tmp/2024-08-01_17-33-22/meta/image_files.xml.
240801 17:33:44 MAIN    INFO: Full Image Backup operation completed successfully.
240801 17:33:44 MAIN    INFO: Backup image created successfully.
240801 17:33:44 MAIN    INFO: Image Path = /mysql/backup/backup-db/fullbackup20240801.mbi
240801 17:33:44 MAIN    INFO: MySQL binlog position: filename mybinlog.000019, position 2095
240801 17:33:44 MAIN    INFO: GTID_EXECUTED is 02283b7e-7a50-11ee-bcd0-000c290123bd:1-4,02283b7e-7a50-11ee-bcd0-000c290123cd:1-13,c29a1b76-77a0-11ee-a26a-000c2959421a:1-53

-------------------------------------------------------------
   Parameters Summary         
-------------------------------------------------------------
   Start LSN                  : 4798413312
   End LSN                    : 4798413603
-------------------------------------------------------------

mysqlbackup completed OK!

2.备份文件查看 

[root@mysql1 backup]# cd backup-db/
[root@mysql1 backup-db]# ll
total 3691872
-rw-r--r-- 1 root root 3780472967 Aug  1 17:33 fullbackup20240801.mbi
[root@mysql1 backup-db]# du -sh *
3.6G	fullbackup20240801.mbi

3.验证备份的完整性 

mysqlbackup --backup-image=/mysql/backup/backup-db/fullbackup20240801.mbi validate
[root@mysql1 backup-db]# mysqlbackup --backup-image=/mysql/backup/backup-db/fullbackup20240801.mbi validate
MySQL Enterprise Backup version 4.1.1 Linux-4.1.12-37.4.1.el6uek.x86_64-x86_64 [2018/04/24 08:26:22] 
Copyright (c) 2003, 2018, Oracle and/or its affiliates. All Rights Reserved.
[Build ID : 12942442.c465cfd7261c781502aec204494abf138f9d59e6]

240801 17:37:20 MAIN    INFO: A thread created with Id '140671216875328' 
240801 17:37:20 MAIN    INFO: Starting with following command line ...
 mysqlbackup 
        --backup-image=/mysql/backup/backup-db/fullbackup20240801.mbi validate 

240801 17:37:20 MAIN    INFO: 
IMPORTANT: Please check that mysqlbackup run completes successfully.
           At the end of a successful 'validate' run mysqlbackup
           prints "mysqlbackup completed OK!".

240801 17:37:20 MAIN    INFO: Backup Image MEB version string: 4.1.1 [2018/04/24 08:26:22]
240801 17:37:20 MAIN    INFO: MySQL server version is '5.7.34'
240801 17:37:20 MAIN    INFO: TDE Keyring service initialized.
240801 17:37:20 MAIN    INFO: Creating 14 buffers each of size 16777216.
240801 17:37:20 MAIN    INFO: Validate operation starts with following threads
		1 read-threads    6 process-threads
240801 17:37:20 MAIN    INFO: Validating image ... /mysql/backup/backup-db/fullbackup20240801.mbi
240801 17:37:20 PCR4    INFO: A thread created with Id '140670818989824' 
240801 17:37:20 PCR5    INFO: A thread created with Id '140670810597120' 
240801 17:37:20 RDR1    INFO: A thread created with Id '140670852560640' 
240801 17:37:20 PCR1    INFO: A thread created with Id '140670844167936' 
240801 17:37:20 PCR2    INFO: A thread created with Id '140670835775232' 
240801 17:37:20 PCR6    INFO: A thread created with Id '140670802204416' 
240801 17:37:20 PCR3    INFO: A thread created with Id '140670827382528' 
240801 17:37:20 PCR4    INFO: Validate: [Dir]: meta
240801 17:37:21 RDR1 Progress in MB: 200 400 600 800 1000 
240801 17:37:23 PCR2    INFO: Validate: [Dir]: datadir/itpuxdb1
240801 17:37:23 PCR2    INFO: Validate: [Dir]: datadir/itpuxdb2
240801 17:37:23 PCR2    INFO: Validate: [Dir]: datadir/mysql
240801 17:37:23 PCR2    INFO: Validate: [Dir]: datadir/performance_schema
240801 17:37:23 PCR2    INFO: Validate: [Dir]: datadir/sys
240801 17:37:23 PCR2    INFO: Validate: [Dir]: datadir/test
240801 17:37:23 RDR1 Progress in MB: 1200 1400 1600 1800 2000 2200 2400 2600 2800 3000 3200 3400 3600 
240801 17:37:30 PCR4    INFO: Validate: [Dir]: datadir/itpuxdb1
240801 17:37:30 PCR4    INFO: Validate: [Dir]: datadir/itpuxdb2
240801 17:37:30 PCR4    INFO: Validate: [Dir]: datadir/mysql
240801 17:37:30 PCR4    INFO: Validate: [Dir]: datadir/performance_schema
240801 17:37:30 PCR4    INFO: Validate: [Dir]: datadir/sys
240801 17:37:30 PCR4    INFO: Validate: [Dir]: datadir/test
240801 17:37:30 MAIN    INFO: Total files as specified in image: 323
240801 17:37:30 MAIN    INFO: datadir/ibdata validated.
240801 17:37:30 MAIN    INFO: datadir/itpuxdb1/itpuxbak11.ibd validated.
240801 17:37:30 MAIN    INFO: datadir/itpuxdb2/itpuxbak21.ibd validated.
240801 17:37:30 MAIN    INFO: datadir/mysql/engine_cost.ibd validated.
240801 17:37:30 MAIN    INFO: datadir/mysql/gtid_executed.ibd validated.
240801 17:37:30 MAIN    INFO: datadir/mysql/help_category.ibd validated.
240801 17:37:30 MAIN    INFO: datadir/mysql/help_keyword.ibd validated.
240801 17:37:30 MAIN    INFO: datadir/mysql/help_relation.ibd validated.
240801 17:37:30 MAIN    INFO: datadir/mysql/help_topic.ibd validated.
240801 17:37:30 MAIN    INFO: datadir/mysql/innodb_index_stats.ibd validated.
240801 17:37:30 MAIN    INFO: datadir/mysql/innodb_table_stats.ibd validated.
240801 17:37:30 MAIN    INFO: datadir/mysql/plugin.ibd validated.
240801 17:37:30 MAIN    INFO: datadir/mysql/server_cost.ibd validated.
240801 17:37:30 MAIN    INFO: datadir/mysql/servers.ibd validated.
240801 17:37:30 MAIN    INFO: datadir/mysql/slave_master_info.ibd validated.
240801 17:37:30 MAIN    INFO: datadir/mysql/slave_relay_log_info.ibd validated.
240801 17:37:30 MAIN    INFO: datadir/mysql/slave_worker_info.ibd validated.
240801 17:37:30 MAIN    INFO: datadir/mysql/time_zone.ibd validated.
240801 17:37:30 MAIN    INFO: datadir/mysql/time_zone_leap_second.ibd validated.
240801 17:37:30 MAIN    INFO: datadir/mysql/time_zone_name.ibd validated.
240801 17:37:30 MAIN    INFO: datadir/mysql/time_zone_transition.ibd validated.
240801 17:37:30 MAIN    INFO: datadir/mysql/time_zone_transition_type.ibd validated.
240801 17:37:30 MAIN    INFO: datadir/sys/sys_config.ibd validated.
240801 17:37:30 MAIN    INFO: datadir/test/test1.ibd validated.
240801 17:37:30 MAIN    INFO: Validate operation completed successfully.
240801 17:37:30 MAIN    INFO: Backup Image validation successful.
240801 17:37:30 MAIN    INFO: Source Image Path = /mysql/backup/backup-db/fullbackup20240801.mbi

mysqlbackup completed OK!

4.备份文件恢复 

mysqlbackup --defaults-file=/etc/my.cnf --user=root \
--password=rootroot --datadir=/data/mysql/data \
--backup-image=/mysql/backup/backup-db/fullbackup20240801.mbi \
--backup-dir=/mysql/backup/restore-tmp copy-back-and-apply-log

[root@mysql2 backup]# mysqlbackup --defaults-file=/etc/my.cnf --user=root --password=rootroot --datadir=/data/mysql/data --backup-image=/mysql/backup/backup-db/fullbackup20240801.mbi --backup-dir=/mysql/backup/restore-tmp copy-back-and-apply-log
MySQL Enterprise Backup version 4.1.1 Linux-4.1.12-37.4.1.el6uek.x86_64-x86_64 [2018/04/24 08:26:22] 
Copyright (c) 2003, 2018, Oracle and/or its affiliates. All Rights Reserved.
[Build ID : 12942442.c465cfd7261c781502aec204494abf138f9d59e6]

240801 17:50:14 MAIN    INFO: A thread created with Id '140042581129024' 
240801 17:50:14 MAIN    INFO: Starting with following command line ...
 mysqlbackup --defaults-file=/etc/my.cnf --user=root --password=xxxxxxxx 
        --datadir=/data/mysql/data 
        --backup-image=/mysql/backup/backup-db/fullbackup20240801.mbi 
        --backup-dir=/mysql/backup/restore-tmp copy-back-and-apply-log 

240801 17:50:14 MAIN    INFO: 
IMPORTANT: Please check that mysqlbackup run completes successfully.
           At the end of a successful 'copy-back-and-apply-log' run mysqlbackup
           prints "mysqlbackup completed OK!".

240801 17:50:14 MAIN    INFO: Backup Image MEB version string: 4.1.1 [2018/04/24 08:26:22]
240801 17:50:14 MAIN    INFO: MySQL server version is '5.7.34'
240801 17:50:14 MAIN    INFO: KEF source path:'/mysql/backup/restore-tmp/meta'
240801 17:50:14 MAIN    INFO: KEF target path:'/data/mysql/data'
240801 17:50:14 MAIN    INFO: TDE Keyring service initialized.
240801 17:50:14 MAIN    INFO: MEB logfile created at /mysql/backup/restore-tmp/meta/MEB_2024-08-01.17-50-14_copy_back_img_to_datadir.log

--------------------------------------------------------------------
                       Server Repository Options:
--------------------------------------------------------------------
  datadir                        = /data/mysql/data
  innodb_data_home_dir           = /data/mysql/data
  innodb_data_file_path          = ibdata:1G:autoextend
  innodb_log_group_home_dir      = /data/mysql/data
  innodb_log_files_in_group      = 2
  innodb_log_file_size           = 256M
  innodb_buffer_pool_filename    = ib_buffer_pool
  innodb_page_size               = Null
  innodb_checksum_algorithm      = crc32

--------------------------------------------------------------------
                       Backup Config Options:
--------------------------------------------------------------------
  datadir                        = /mysql/backup/restore-tmp/datadir
  innodb_data_home_dir           = /mysql/backup/restore-tmp/datadir
  innodb_data_file_path          = ibdata:1G:autoextend
  innodb_log_group_home_dir      = /mysql/backup/restore-tmp/datadir
  innodb_log_files_in_group      = 2
  innodb_log_file_size           = 268435456
  innodb_buffer_pool_filename    = ib_buffer_pool
  innodb_page_size               = 16384
  innodb_checksum_algorithm      = crc32

240801 17:50:14 MAIN    INFO: Creating 14 buffers each of size 16777216.
240801 17:50:14 MAIN    INFO: Copy-back-and-apply-log operation starts with following threads
		1 read-threads    6 process-threads    1 write-threads
240801 17:50:14 PCR3    INFO: A thread created with Id '140042191636224' 
240801 17:50:14 PCR4    INFO: A thread created with Id '140042183243520' 
240801 17:50:14 RDR1    INFO: A thread created with Id '140042216814336' 
240801 17:50:14 RDR1    INFO: Copying ibdata.
240801 17:50:14 PCR1    INFO: A thread created with Id '140042208421632' 
240801 17:50:14 PCR5    INFO: A thread created with Id '140042174850816' 
240801 17:50:14 PCR6    INFO: A thread created with Id '140042166458112' 
240801 17:50:14 WTR1    INFO: A thread created with Id '140042158065408' 
240801 17:50:14 PCR2    INFO: A thread created with Id '140042200028928' 
240801 17:50:14 PCR3    INFO: Copying database directory: meta
240801 17:50:15 RDR1 Progress in MB: 200 400 600 800 1000 
240801 17:50:18 RDR1    INFO: Copying itpuxdb1/itpuxbak11.ibd.
240801 17:50:18 PCR3    INFO: Copying database directory: itpuxdb1
240801 17:50:18 RDR1    INFO: Copying itpuxdb2/itpuxbak21.ibd.
240801 17:50:18 PCR3    INFO: Copying database directory: itpuxdb2
240801 17:50:18 RDR1    INFO: Copying mysql/engine_cost.ibd.
240801 17:50:18 PCR3    INFO: Copying database directory: mysql
240801 17:50:18 RDR1    INFO: Copying mysql/gtid_executed.ibd.
240801 17:50:18 RDR1    INFO: Copying mysql/help_category.ibd.
240801 17:50:18 RDR1    INFO: Copying mysql/help_keyword.ibd.
240801 17:50:18 RDR1    INFO: Copying mysql/help_relation.ibd.
240801 17:50:18 RDR1    INFO: Copying mysql/help_topic.ibd.
240801 17:50:19 RDR1    INFO: Copying mysql/innodb_index_stats.ibd.
240801 17:50:19 RDR1    INFO: Copying mysql/innodb_table_stats.ibd.
240801 17:50:19 RDR1    INFO: Copying mysql/plugin.ibd.
240801 17:50:19 RDR1    INFO: Copying mysql/server_cost.ibd.
240801 17:50:19 RDR1    INFO: Copying mysql/servers.ibd.
240801 17:50:19 RDR1    INFO: Copying mysql/slave_master_info.ibd.
240801 17:50:19 RDR1    INFO: Copying mysql/slave_relay_log_info.ibd.
240801 17:50:19 RDR1    INFO: Copying mysql/slave_worker_info.ibd.
240801 17:50:19 RDR1    INFO: Copying mysql/time_zone.ibd.
240801 17:50:19 RDR1    INFO: Copying mysql/time_zone_leap_second.ibd.
240801 17:50:19 RDR1    INFO: Copying mysql/time_zone_name.ibd.
240801 17:50:19 RDR1    INFO: Copying mysql/time_zone_transition.ibd.
240801 17:50:19 RDR1    INFO: Copying mysql/time_zone_transition_type.ibd.
240801 17:50:19 RDR1    INFO: Copying sys/sys_config.ibd.
240801 17:50:19 PCR3    INFO: Copying database directory: performance_schema
240801 17:50:19 PCR3    INFO: Copying database directory: sys
240801 17:50:19 RDR1    INFO: Copying test/test1.ibd.
240801 17:50:19 PCR3    INFO: Copying database directory: test
240801 17:50:19 RDR1 Progress in MB: 1200 1400 1600 1800 2000 2200 2400 2600 2800 3000 3200 3400 3600 
240801 17:50:27 RDR1    INFO: Copying mybinlog.000014.
240801 17:50:27 RDR1    INFO: Copying mybinlog.000015.
240801 17:50:27 RDR1    INFO: Copying mybinlog.000016.
240801 17:50:27 RDR1    INFO: Copying mybinlog.000017.
240801 17:50:28 RDR1    INFO: Copying mybinlog.000018.
240801 17:50:28 RDR1    INFO: Copying mysql1-relay-bin.000001.
240801 17:50:28 RDR1    INFO: Copying mysql1-relay-bin.000002.
240801 17:50:28 RDR1    INFO: Copying mysql1-relay-bin.000003.
240801 17:50:28 RDR1    INFO: Copying mysql1-relay-bin.000004.
240801 17:50:28 RDR1    INFO: Copying mybinlog.000019.
240801 17:50:28 RDR1    INFO: Copying mysql1-relay-bin.000005.
240801 17:50:28 PCR3    INFO: Copying database directory: itpuxdb1
240801 17:50:28 PCR3    INFO: Copying database directory: itpuxdb2
240801 17:50:28 PCR3    INFO: Copying database directory: mysql
240801 17:50:28 PCR3    INFO: Copying database directory: performance_schema
240801 17:50:28 PCR3    INFO: Copying database directory: sys
240801 17:50:28 PCR3    INFO: Copying database directory: test
240801 17:50:28 MAIN    INFO: Total files as specified in image: 323
240801 17:50:28 MAIN    INFO: MySQL server version is '5.7.34-log'
240801 17:50:28 MAIN    INFO: MySQL server compile os version is 'Linux'
240801 17:50:28 MAIN    INFO: Writing config file for server '5.7.34-log'.
240801 17:50:28 MAIN    INFO: Creating server config files server-my.cnf and server-all.cnf in /data/mysql/data
240801 17:50:28 MAIN    INFO: Variable 'datadir'='/data/mysql/data/'->'/data/mysql/data' option 'datadir' type 0
240801 17:50:28 MAIN    INFO: Variable 'datadir'='/data/mysql/data/'->'/data/mysql/data' option 'datadir' type 0
240801 17:50:28 MAIN    INFO: Variable 'innodb_buffer_pool_filename'='ib_buffer_pool'->'ib_buffer_pool' option 'innodb_buffer_pool_filename' type 9
240801 17:50:28 MAIN    INFO: Variable 'innodb_buffer_pool_filename'='ib_buffer_pool'->'ib_buffer_pool' option 'innodb_buffer_pool_filename' type 9
240801 17:50:28 MAIN    INFO: Variable 'innodb_checksum_algorithm'='crc32'->'crc32' option 'innodb_checksum_algorithm' type 11
240801 17:50:28 MAIN    INFO: Variable 'innodb_checksum_algorithm'='crc32'->'crc32' option 'innodb_checksum_algorithm' type 11
240801 17:50:28 MAIN    INFO: Variable 'innodb_checksums'='ON'->'ON' option 'innodb_checksums' type 12
240801 17:50:28 MAIN    INFO: Variable 'innodb_checksums'='ON'->'ON' option 'innodb_checksums' type 12
240801 17:50:28 MAIN    INFO: Variable 'innodb_data_file_path'='ibdata:1G:autoextend'->'ibdata:1G:autoextend' option 'innodb_data_file_path' type 2
240801 17:50:28 MAIN    INFO: Variable 'innodb_data_file_path'='ibdata:1G:autoextend'->'ibdata:1G:autoextend' option 'innodb_data_file_path' type 2
240801 17:50:28 MAIN    INFO: Variable 'innodb_data_home_dir'=''->'/data/mysql/data' option 'innodb_data_home_dir' type 1
240801 17:50:28 MAIN    INFO: Variable 'innodb_log_file_size'='268435456'->'256M' option 'innodb_log_file_size' type 5
240801 17:50:28 MAIN    INFO: Variable 'innodb_log_file_size'='268435456'->'256M' option 'innodb_log_file_size' type 5
240801 17:50:28 MAIN    INFO: Variable 'innodb_log_files_in_group'='2'->'2' option 'innodb_log_files_in_group' type 4
240801 17:50:28 MAIN    INFO: Variable 'innodb_log_files_in_group'='2'->'2' option 'innodb_log_files_in_group' type 4
240801 17:50:28 MAIN    INFO: Variable 'innodb_log_group_home_dir'='./'->'/data/mysql/data' option 'innodb_log_group_home_dir' type 3
240801 17:50:28 MAIN    INFO: Variable 'innodb_log_group_home_dir'='./'->'/data/mysql/data' option 'innodb_log_group_home_dir' type 3
240801 17:50:28 MAIN    INFO: Variable 'innodb_page_size'='16384'->'16384' option 'innodb_page_size' type 10
240801 17:50:28 MAIN    INFO: Variable 'innodb_page_size'='16384'->'16384' option 'innodb_page_size' type 10
240801 17:50:28 MAIN    INFO: Variable 'innodb_undo_directory'='./'->'/data/mysql/data' option 'innodb_undo_directory' type 6
240801 17:50:28 MAIN    INFO: Variable 'innodb_undo_directory'='./'->'/data/mysql/data' option 'innodb_undo_directory' type 6
240801 17:50:28 MAIN    INFO: Variable 'innodb_undo_logs'='128'->'128' option 'innodb_undo_logs' type 8
240801 17:50:28 MAIN    INFO: Variable 'innodb_undo_logs'='128'->'128' option 'innodb_undo_logs' type 8
240801 17:50:28 MAIN    INFO: Variable 'innodb_undo_tablespaces'='0'->'0' option 'innodb_undo_tablespaces' type 7
240801 17:50:28 MAIN    INFO: Variable 'innodb_undo_tablespaces'='0'->'0' option 'innodb_undo_tablespaces' type 7
240801 17:50:28 MAIN    INFO: Copy-back operation completed successfully.
240801 17:50:28 MAIN    INFO: Source Image Path = /mysql/backup/backup-db/fullbackup20240801.mbi


240801 17:50:28 MAIN    INFO: MySQL server version is '5.7.34-log'
240801 17:50:28 MAIN    INFO: Restoring ...5.7.34-log version
240801 17:50:28 MAIN    INFO: Creating 14 buffers each of size 65536.
240801 17:50:28 MAIN    INFO: Apply-log operation starts with following threads
		1 read-threads    1 process-threads    6 apply-threads
240801 17:50:28 MAIN    INFO: Using up to 100 MB of memory.
240801 17:50:28 MAIN    INFO: ibbackup_logfile''s creation parameters:
          start lsn 4798413312, end lsn 4798413603,
          start checkpoint 4798413594.
240801 17:50:28 ALW1    INFO: A thread created with Id '140042158065408' 
240801 17:50:28 ALW2    INFO: A thread created with Id '140042166458112' 
240801 17:50:28 ALW3    INFO: A thread created with Id '140042174850816' 
240801 17:50:28 ALW4    INFO: A thread created with Id '140042183243520' 
240801 17:50:28 ALW5    INFO: A thread created with Id '140042447951616' 
240801 17:50:28 ALW6    INFO: A thread created with Id '140042439558912' 
240801 17:50:28 RDR1    INFO: A thread created with Id '140042431166208' 
240801 17:50:28 PCR1    INFO: A thread created with Id '140042422773504' 
240801 17:50:28 PCR1    INFO: InnoDB: Doing recovery: scanned up to log sequence number 4798413603.
240801 17:50:28 PCR1    INFO: InnoDB: Starting an apply batch of log records to the database...
.
InnoDB: Progress in percent: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 
240801 17:50:28 PCR1    INFO: InnoDB: Setting log file size to 268435456.
240801 17:50:28 PCR1    INFO: InnoDB: Progress in MB:.
 100 200
240801 17:50:29 PCR1    INFO: InnoDB: Setting log file size to 268435456.
240801 17:50:29 PCR1    INFO: InnoDB: Progress in MB:.
 100 200
240801 17:50:29 PCR1    INFO: We were able to parse ibbackup_logfile up to
          lsn 4798413603.
240801 17:50:29 PCR1    INFO: Last MySQL binlog file position 0 2095, file name mybinlog.000019
240801 17:50:29 PCR1    INFO: The first data file is '/data/mysql/data/ibdata'
                              and the new created log files are at '/data/mysql/data'
240801 17:50:29 MAIN    INFO: MySQL server version is '5.7.34-log'
240801 17:50:29 MAIN    INFO: Restoring ...5.7.34-log version
240801 17:50:29 MAIN    INFO: No Keyring file to process.
240801 17:50:29 MAIN    INFO: Apply-log operation completed successfully.
240801 17:50:29 MAIN    INFO: Full Backup has been restored successfully.

mysqlbackup completed OK!

6.重做备库。

[root@mysql2 data]# more backup_gtid_executed.sql
# On a new slave, issue the following command if GTIDs are enabled:
  SET @@GLOBAL.GTID_PURGED='02283b7e-7a50-11ee-bcd0-000c290123bd:1-4,02283b7e-7a50-11ee-bcd0-000c290123cd:1-13,c29a1b76-77a0-11ee-a26a-000c2959421a:1-53';

# Use the following command if you want to use the GTID handshake protocol:
# CHANGE MASTER TO MASTER_AUTO_POSITION=1; 
--启动从库。
systemctl start mysqld  
mysql -uroot -prootroot 

reset master; 
set @MYSQLDUMP_TEMP_LOG_BIN = @@SESSION.SQL_LOG_BIN;
set @@SESSION.SQL_LOG_BIN= 0;
SET @@GLOBAL.GTID_PURGED='02283b7e-7a50-11ee-bcd0-000c290123bd:1-4,02283b7e-7a50-11ee-bcd0-000c290123cd:1-13,c29a1b76-77a0-11ee-a26a-000c2959421a:1-53';
set @@SESSION.SQL_LOG_BIN = @MYSQLDUMP_TEMP_LOG_BIN;

--设置同步。
change master to
master_host='192.168.1.11',
master_port=3306,
master_user='repuser',
master_password='repuser123',
master_auto_position=1;

"root@localhost">start slave; 
ERROR 1872 (HY000): Slave failed to initialize relay log info structure from the repository
"root@localhost">
--需要添加 relay_log 参数。
[root@mysql2 data]# cat /etc/my.cnf|grep relay
#relay log
relay_log = /data/mysql/data/mysql2-relay.log

--重启数据库 
systemctl restart  mysqld 

--启动从库复制。
"root@localhost">start slave;
Query OK, 0 rows affected (0.01 sec)

"root@localhost">show slave status\G;
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 192.168.1.11
                  Master_User: repuser
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mybinlog.000019
          Read_Master_Log_Pos: 2095
               Relay_Log_File: mysql2-relay.000002
                Relay_Log_Pos: 411
        Relay_Master_Log_File: mybinlog.000019
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB: 
          Replicate_Ignore_DB: 
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
                   Last_Errno: 0
                   Last_Error: 
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 2095
              Relay_Log_Space: 615
              Until_Condition: None
               Until_Log_File: 
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File: 
           Master_SSL_CA_Path: 
              Master_SSL_Cert: 
            Master_SSL_Cipher: 
               Master_SSL_Key: 
        Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error: 
               Last_SQL_Errno: 0
               Last_SQL_Error: 
  Replicate_Ignore_Server_Ids: 
             Master_Server_Id: 113306
                  Master_UUID: 02283b7e-7a50-11ee-bcd0-000c290123cd
             Master_Info_File: /data/mysql/data/master.info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
           Master_Retry_Count: 86400
                  Master_Bind: 
      Last_IO_Error_Timestamp: 
     Last_SQL_Error_Timestamp: 
               Master_SSL_Crl: 
           Master_SSL_Crlpath: 
           Retrieved_Gtid_Set: 
            Executed_Gtid_Set: 02283b7e-7a50-11ee-bcd0-000c290123bd:1-4,
02283b7e-7a50-11ee-bcd0-000c290123cd:1-13,
c29a1b76-77a0-11ee-a26a-000c2959421a:1-53
                Auto_Position: 1
         Replicate_Rewrite_DB: 
                 Channel_Name: 
           Master_TLS_Version: 
1 row in set (0.00 sec)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值