Preface
 
    I've been demonstrated how to implement a master-slave structure using mysqldump in my previous blog.I'm gonna use Xtrabackup to do it again now.
 
Framework
 
Hostname IP/Port Identity OS Version MySQL Version GTID Mode Binlog Format
zlm2 192.168.1.101/3306 master CentOS 7.0 5.7.21 on row
zlm3 192.168.1.102/3306 slave CentOS 7.0 5.7.21 on row
 
Procedure
 
Generate a physical backup on master.
 [root@zlm2 :: ~]
#innobackupex --defaults-file-/data/mysql/mysql3306/my3306.cnf /data/backup
xtrabackup: recognized server arguments:
xtrabackup: recognized client arguments:
:: innobackupex: Starting the backup operation IMPORTANT: Please check that the backup run completes successfully.
At the end of a successful backup run innobackupex
prints "completed OK!". :: version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;host=192.168.1.101;mysql_socket=/tmp/mysql3306.sock' as 'zlm' (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: 192.168.1.101, user: zlm, password: set, port: not set, socket: /tmp/mysql3306.sock
Using server version 5.7.-log
innobackupex version 2.4. based on MySQL server 5.7. Linux (x86_64) (revision id: 170eb8c)
xtrabackup: uses posix_fadvise().
xtrabackup: cd to /data/mysql/mysql3306/data/ //Change directory to the datadir of current instance.
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 = ./
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 mysql/plugin, old maximum was
:: [] Copying ./ibdata1 to /data/backup/--25_04--/ibdata1 //Copy shared tablespace file to the target of backup directory.
:: >> log scanned up to () //The redo logfiles are continuously written before copy .ibd files.
:: >> log scanned up to ()
:: [] ...done
:: >> log scanned up to ()
:: >> log scanned up to ()
:: [] Copying ./mysql/plugin.ibd to /data/backup/--25_04--/mysql/plugin.ibd //begins to copy data of innodb table(.ibd).
:: [] ...done
:: [] Copying ./mysql/servers.ibd to /data/backup/--25_04--/mysql/servers.ibd
:: [] ...done
:: [] Copying ./mysql/help_topic.ibd to /data/backup/--25_04--/mysql/help_topic.ibd
:: [] ...done
:: >> log scanned up to ()
:: [] Copying ./mysql/help_category.ibd to /data/backup/--25_04--/mysql/help_category.ibd
:: [] ...done
:: [] Copying ./mysql/help_relation.ibd to /data/backup/--25_04--/mysql/help_relation.ibd
:: [] ...done
:: [] Copying ./mysql/help_keyword.ibd to /data/backup/--25_04--/mysql/help_keyword.ibd
:: [] ...done
:: [] Copying ./mysql/time_zone_name.ibd to /data/backup/--25_04--/mysql/time_zone_name.ibd
:: [] ...done
:: [] Copying ./mysql/time_zone.ibd to /data/backup/--25_04--/mysql/time_zone.ibd
:: [] ...done
:: [] Copying ./mysql/time_zone_transition.ibd to /data/backup/--25_04--/mysql/time_zone_transition.ibd
:: [] ...done
:: [] Copying ./mysql/time_zone_transition_type.ibd to /data/backup/--25_04--/mysql/time_zone_transition_type.ibd
:: [] ...done
:: [] Copying ./mysql/time_zone_leap_second.ibd to /data/backup/--25_04--/mysql/time_zone_leap_second.ibd
:: [] ...done
:: [] Copying ./mysql/innodb_table_stats.ibd to /data/backup/--25_04--/mysql/innodb_table_stats.ibd
:: [] ...done
:: [] Copying ./mysql/innodb_index_stats.ibd to /data/backup/--25_04--/mysql/innodb_index_stats.ibd
:: [] ...done
:: [] Copying ./mysql/slave_relay_log_info.ibd to /data/backup/--25_04--/mysql/slave_relay_log_info.ibd
:: [] ...done
:: [] Copying ./mysql/slave_master_info.ibd to /data/backup/--25_04--/mysql/slave_master_info.ibd
:: [] ...done
:: [] Copying ./mysql/slave_worker_info.ibd to /data/backup/--25_04--/mysql/slave_worker_info.ibd
:: [] ...done
:: [] Copying ./mysql/gtid_executed.ibd to /data/backup/--25_04--/mysql/gtid_executed.ibd
:: [] ...done
:: [] Copying ./mysql/server_cost.ibd to /data/backup/--25_04--/mysql/server_cost.ibd
:: [] ...done
:: [] Copying ./mysql/engine_cost.ibd to /data/backup/--25_04--/mysql/engine_cost.ibd
:: [] ...done
:: [] Copying ./sys/sys_config.ibd to /data/backup/--25_04--/sys/sys_config.ibd
:: [] ...done
:: [] Copying ./zlm/test_innodb.ibd to /data/backup/--25_04--/zlm/test_innodb.ibd
:: [] ...done
:: [] Copying ./zlm/test_ddl.ibd to /data/backup/--25_04--/zlm/test_ddl.ibd
:: [] ...done
:: [] Copying ./zlm/test_ddl_no_pk.ibd to /data/backup/--25_04--/zlm/test_ddl_no_pk.ibd
:: [] ...done
:: [] Copying ./zlm/test_index_usage.ibd to /data/backup/--25_04--/zlm/test_index_usage.ibd
:: [] ...done
:: >> log scanned up to ()
:: [] Copying ./zlm/test_charset.ibd to /data/backup/--25_04--/zlm/test_charset.ibd
:: [] ...done
:: [] Copying ./zlm/test_null.ibd to /data/backup/--25_04--/zlm/test_null.ibd
:: [] ...done
:: [] Copying ./zlm/test_convert.ibd to /data/backup/--25_04--/zlm/test_convert.ibd
:: [] ...done
:: >> log scanned up to ()
:: Executing FLUSH NO_WRITE_TO_BINLOG TABLES... //In order to avoid writting binlog,new version will use "NO_WRITE_TO_BINLOG" option.
:: Executing FLUSH TABLES WITH READ LOCK... //Generate a FTWRL.
:: Starting to backup non-InnoDB tables and files
:: [] Copying ./mysql/db.opt to /data/backup/--25_04--/mysql/db.opt
:: [] ...done
:: [] Copying ./mysql/db.frm to /data/backup/--25_04--/mysql/db.frm
:: [] ...done
:: [] Copying ./mysql/db.MYI to /data/backup/--25_04--/mysql/db.MYI
:: [] ...done
:: [] Copying ./mysql/db.MYD to /data/backup/--25_04--/mysql/db.MYD
:: [] ...done
:: [] Copying ./mysql/user.frm to /data/backup/--25_04--/mysql/user.frm
:: [] ...done
:: [] Copying ./mysql/user.MYI to /data/backup/--25_04--/mysql/user.MYI
:: [] ...done
:: [] Copying ./mysql/user.MYD to /data/backup/--25_04--/mysql/user.MYD ... //A bundle of MyISAM tables(.MYI,.MYD,.frm) and innodb table structure(.frm) copied here,omitted. :: [] Copying ./zlm/db.opt to /data/backup/--25_04--/zlm/db.opt
:: [] ...done
:: [] Copying ./zlm/test_innodb.frm to /data/backup/--25_04--/zlm/test_innodb.frm
:: [] ...done
:: [] Copying ./zlm/test_myisam.frm to /data/backup/--25_04--/zlm/test_myisam.frm
:: [] ...done
:: [] Copying ./zlm/test_myisam.MYI to /data/backup/--25_04--/zlm/test_myisam.MYI
:: [] ...done
:: [] Copying ./zlm/test_myisam.MYD to /data/backup/--25_04--/zlm/test_myisam.MYD
:: [] ...done
:: [] Copying ./zlm/test_ddl.frm to /data/backup/--25_04--/zlm/test_ddl.frm
:: [] ...done
:: [] Copying ./zlm/test_ddl_no_pk.frm to /data/backup/--25_04--/zlm/test_ddl_no_pk.frm
:: [] ...done
:: [] Copying ./zlm/test_index_usage.frm to /data/backup/--25_04--/zlm/test_index_usage.frm
:: [] ...done
:: [] Copying ./zlm/test_charset.frm to /data/backup/--25_04--/zlm/test_charset.frm
:: [] ...done
:: [] Copying ./zlm/test_null.frm to /data/backup/--25_04--/zlm/test_null.frm
:: [] ...done
:: [] Copying ./zlm/test_convert.frm to /data/backup/--25_04--/zlm/test_convert.frm
:: [] ...done
:: Finished backing up non-InnoDB tables and files
:: [] Writing /data/backup/--25_04--/xtrabackup_binlog_info
:: [] ...done
:: Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS... //Flushes redo logfiles whith writting them into binlog.
xtrabackup: The latest check point (for incremental): '' //Prints the last checkpoint.
xtrabackup: Stopping log copying thread.
. :: >> log scanned up to () :: Executing UNLOCK TABLES
:: All tables unlocked
:: [] Copying ib_buffer_pool to /data/backup/--25_04--/ib_buffer_pool
:: [] ...done
:: Backup created in directory '/data/backup/2018-07-25_04-00-42/'
MySQL binlog position: filename 'mysql-bin.000027', position '', GTID of the last change '1b7181ee-6eaf-11e8-998e-080027de0e0e:1-3730021'
:: [] Writing /data/backup/--25_04--/backup-my.cnf
:: [] ...done
:: [] Writing /data/backup/--25_04--/xtrabackup_info
:: [] ...done
xtrabackup: Transaction log of lsn () to () was copied. //Prints the backuped lsn information.
:: completed OK!
Check the outputfile of Xtrabackup.
 [root@zlm2 :: /data/backup]
#cd /data/backup/ [root@zlm2 :: /data/backup]
#ls -l
total
drwxr-x--- root root Jul : --25_04-- [root@zlm2 :: /data/backup]
#cd --25_04--/ [root@zlm2 :: /data/backup/--25_04--]
#ls -l
total
-rw-r----- root root Jul : backup-my.cnf
-rw-r----- root root Jul : ib_buffer_pool
-rw-r----- root root Jul : ibdata1
drwxr-x--- root root Jul : mysql
drwxr-x--- root root Jul : performance_schema
drwxr-x--- root root Jul : sys
-rw-r----- root root Jul : xtrabackup_binlog_info
-rw-r----- root root Jul : xtrabackup_checkpoints
-rw-r----- root root Jul : xtrabackup_info
-rw-r----- root root Jul : xtrabackup_logfile
drwxr-x--- root root Jul : zlm [root@zlm2 :: /data/backup/--25_04--]
#cat xtrabackup_binlog_info
mysql-bin. 1b7181ee-6eaf-11e8-998e-080027de0e0e:- [root@zlm2 :: /data/backup/--25_04--]
#cat xtrabackup_checkpoints
backup_type = full-backuped
from_lsn =
to_lsn =
last_lsn =
compact =
recover_binlog_info = [root@zlm2 :: /data/backup/--25_04--]
#cat xtrabackup_info
uuid = 8e8d59a6-8fae-11e8-87d6-080027de0e0e
name =
tool_name = innobackupex
tool_command = --defaults-file-/data/mysql/mysql3306/my3306.cnf /data/backup
tool_version = 2.4.
ibbackup_version = 2.4.
server_version = 5.7.-log
start_time = -- ::
end_time = -- ::
lock_time =
binlog_pos = filename 'mysql-bin.000027', position '', GTID of the last change '1b7181ee-6eaf-11e8-998e-080027de0e0e:1-3730021'
innodb_from_lsn =
innodb_to_lsn =
partial = N
incremental = N
format = file
compact = N
compressed = N
encrypted = N
Package the backup set and transfer it to slave server.
 [root@zlm2 :: /data/backup]
#ls -l
total
drwxr-x--- root root Jul : --25_04-- [root@zlm2 :: /data/backup]
#tar cf Xtrabk_full.tar --25_04--/ [root@zlm2 :: /data/backup]
#ls -l
total
drwxr-x--- root root Jul : --25_04--
-rw-r--r-- root root Jul : Xtrabk_full.tar [root@zlm2 :: /data/backup]
#scp Xtrabk_full.tar zlm3:/data/backup
root@zlm3's password:
Xtrabk_full.tar
Unpack the backup set.
 [root@zlm3 :: ~]
#cd /data/backup [root@zlm3 :: /data/backup]
#ls -l
total
-rw-r--r-- root root Jul : Xtrabk_full.tar [root@zlm3 :: /data/backup]
#tar xf Xtrabk_full.tar [root@zlm3 :: /data/backup]
#ls -l
total
drwxr-x--- root root Jul : --25_04--
-rw-r--r-- root root Jul : Xtrabk_full.tar [root@zlm3 :: /data/backup]
#chown -R mysql.mysql --25_04--/ [root@zlm3 :: /data/backup]
#ls -l
total
drwxr-x--- mysql mysql Jul : --25_04--
-rw-r--r-- root root Jul : Xtrabk_full.tar
Apply the redo logfiles,make the datafiles on slave be consistent with those on master(combine the redo into datafiles).
 [root@zlm3 :: /data/backup]
#innobackupex --defaults-file=/data/mysql/mysql3306/my3306.conf --apply-log /data/backup/--25_04--/
xtrabackup: recognized server arguments: --innodb_checksum_algorithm=crc32 --innodb_log_checksum_algorithm=strict_crc32 --innodb_data_file_path=ibdata1:100M:autoextend --innodb_log_files_in_group= --innodb_log_file_size= --innodb_fast_checksum= --innodb_page_size= --innodb_log_block_size= --innodb_undo_directory=./ --innodb_undo_tablespaces= --server-id= --redo-log-version=
xtrabackup: recognized client arguments: --innodb_checksum_algorithm=crc32 --innodb_log_checksum_algorithm=strict_crc32 --innodb_data_file_path=ibdata1:100M:autoextend --innodb_log_files_in_group= --innodb_log_file_size= --innodb_fast_checksum= --innodb_page_size= --innodb_log_block_size= --innodb_undo_directory=./ --innodb_undo_tablespaces= --server-id= --redo-log-version=
:: innobackupex: Starting the apply-log operation IMPORTANT: Please check that the apply-log run completes successfully.
At the end of a successful apply-log run innobackupex
prints "completed OK!". innobackupex version 2.4. based on MySQL server 5.7. Linux (x86_64) (revision id: 170eb8c)
xtrabackup: cd to /data/backup/--25_04--/
xtrabackup: This target seems to be not prepared yet.
InnoDB: Number of pools:
xtrabackup: xtrabackup_logfile detected: size=, start_lsn=()
xtrabackup: using the following InnoDB configuration for recovery:
xtrabackup: innodb_data_home_dir = .
xtrabackup: innodb_data_file_path = ibdata1:100M:autoextend
xtrabackup: innodb_log_group_home_dir = .
xtrabackup: innodb_log_files_in_group =
xtrabackup: innodb_log_file_size =
xtrabackup: using the following InnoDB configuration for recovery:
xtrabackup: innodb_data_home_dir = .
xtrabackup: innodb_data_file_path = ibdata1:100M:autoextend
xtrabackup: innodb_log_group_home_dir = .
xtrabackup: innodb_log_files_in_group =
xtrabackup: innodb_log_file_size =
xtrabackup: Starting InnoDB instance for recovery.
xtrabackup: Using bytes for buffer pool (set by --use-memory parameter)
InnoDB: PUNCH HOLE support available
InnoDB: Mutexes and rw_locks use GCC atomic builtins
InnoDB: Uses event mutexes
InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
InnoDB: Compressed tables use zlib 1.2.
InnoDB: Number of pools:
InnoDB: Using CPU crc32 instructions
InnoDB: Initializing buffer pool, total size = 100M, instances = , chunk size = 100M
InnoDB: Completed initialization of buffer pool
InnoDB: page_cleaner coordinator priority: -
InnoDB: Highest supported file format is Barracuda.
InnoDB: Log scan progressed past the checkpoint lsn
InnoDB: Doing recovery: scanned up to log sequence number (%)
InnoDB: Database was not shutdown normally!
InnoDB: Starting crash recovery.
InnoDB: xtrabackup: Last MySQL binlog file position , file name mysql-bin.
InnoDB: Creating shared tablespace for temporary tables
InnoDB: Setting file './ibtmp1' size to MB. Physically writing the file full; Please wait ...
InnoDB: File './ibtmp1' size is now MB.
InnoDB: redo rollback segment(s) found. redo rollback segment(s) are active.
InnoDB: non-redo rollback segment(s) are active.
InnoDB: Waiting for purge to start
InnoDB: 5.7. started; log sequence number
InnoDB: xtrabackup: Last MySQL binlog file position , file name mysql-bin. xtrabackup: starting shutdown with innodb_fast_shutdown =
InnoDB: FTS optimize thread exiting.
InnoDB: Starting shutdown...
InnoDB: Shutdown completed; log sequence number
InnoDB: Number of pools:
xtrabackup: using the following InnoDB configuration for recovery:
xtrabackup: innodb_data_home_dir = .
xtrabackup: innodb_data_file_path = ibdata1:100M:autoextend
xtrabackup: innodb_log_group_home_dir = .
xtrabackup: innodb_log_files_in_group =
xtrabackup: innodb_log_file_size =
InnoDB: PUNCH HOLE support available
InnoDB: Mutexes and rw_locks use GCC atomic builtins
InnoDB: Uses event mutexes
InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
InnoDB: Compressed tables use zlib 1.2.
InnoDB: Number of pools:
InnoDB: Using CPU crc32 instructions
InnoDB: Initializing buffer pool, total size = 100M, instances = , chunk size = 100M
InnoDB: Completed initialization of buffer pool
InnoDB: page_cleaner coordinator priority: -
InnoDB: Setting log file ./ib_logfile101 size to MB
InnoDB: Progress in MB: InnoDB: Setting log file ./ib_logfile1 size to MB
InnoDB: Progress in MB: InnoDB: Setting log file ./ib_logfile2 size to MB
InnoDB: Progress in MB: InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
InnoDB: New log files created, LSN=
InnoDB: Highest supported file format is Barracuda.
InnoDB: Log scan progressed past the checkpoint lsn
InnoDB: Doing recovery: scanned up to log sequence number (%)
InnoDB: Database was not shutdown normally!
InnoDB: Starting crash recovery.
InnoDB: xtrabackup: Last MySQL binlog file position , file name mysql-bin.
InnoDB: Removed temporary tablespace data file: "ibtmp1"
InnoDB: Creating shared tablespace for temporary tables
InnoDB: Setting file './ibtmp1' size to MB. Physically writing the file full; Please wait ...
InnoDB: File './ibtmp1' size is now MB.
InnoDB: redo rollback segment(s) found. redo rollback segment(s) are active.
InnoDB: non-redo rollback segment(s) are active.
InnoDB: Waiting for purge to start
InnoDB: page_cleaner: 1000ms intended loop took 15837ms. The settings might not be optimal. (flushed= and evicted=, during the time.)
InnoDB: 5.7. started; log sequence number
xtrabackup: starting shutdown with innodb_fast_shutdown =
InnoDB: FTS optimize thread exiting.
InnoDB: Starting shutdown...
InnoDB: Shutdown completed; log sequence number
:: completed OK! [root@zlm3 :: /data/backup/--25_04--]
#cat xtrabackup_binlog_info
mysql-bin. 1b7181ee-6eaf-11e8-998e-080027de0e0e:- [root@zlm3 :: /data/backup/--25_04--]
#cat xtrabackup_binlog_pos_innodb //After applied logs,the binlog infomation is different with it in "xtrabackup_binlog_info".It's acceptable.
mysql-bin.
Copy back the datafiles to the target instance on slave(shutdown the instance first).
 [root@zlm3 :: /data/backup/--25_04--]
#mysqladmin -S /tmp/mysql3306.sock shutdown [root@zlm3 :: /data/backup/--25_04--]
#ps aux|grep mysqld
root 0.0 0.0 pts/ R+ : : grep --color=auto mysqld [root@zlm3 :: /data/backup/--25_04--]
#innobackupex --defaults-file=/data/mysql/mysql3306/my.cnf --copy-back /data/backup/--25_04--/
xtrabackup: recognized server arguments: --datadir=/data/mysql/mysql3306/data --tmpdir=/data/mysql/mysql3306/tmp --open_files_limit= --server-id= --log_bin=/data/mysql/mysql3306/logs/mysql-bin --innodb_buffer_pool_size=100M --innodb_data_file_path=ibdata1:100M:autoextend --innodb_flush_log_at_trx_commit= --innodb_log_buffer_size=8M --innodb_log_file_size=100M --innodb_log_files_in_group= --innodb_max_dirty_pages_pct= --innodb_file_per_table= --innodb_io_capacity= --innodb_flush_method=O_DIRECT --server-id=
xtrabackup: recognized client arguments: --datadir=/data/mysql/mysql3306/data --tmpdir=/data/mysql/mysql3306/tmp --open_files_limit= --server-id= --log_bin=/data/mysql/mysql3306/logs/mysql-bin --innodb_buffer_pool_size=100M --innodb_data_file_path=ibdata1:100M:autoextend --innodb_flush_log_at_trx_commit= --innodb_log_buffer_size=8M --innodb_log_file_size=100M --innodb_log_files_in_group= --innodb_max_dirty_pages_pct= --innodb_file_per_table= --innodb_io_capacity= --innodb_flush_method=O_DIRECT --server-id=
:: innobackupex: Starting the copy-back operation IMPORTANT: Please check that the copy-back run completes successfully.
At the end of a successful copy-back run innobackupex
prints "completed OK!". innobackupex version 2.4. based on MySQL server 5.7. Linux (x86_64) (revision id: 170eb8c)
Original data directory /data/mysql/mysql3306/data is not empty! //It indicates the directory should be cleaned. [root@zlm3 :: /data/backup/--25_04--]
#cd /data/mysql/mysql3306/data [root@zlm3 :: /data/mysql/mysql3306/data]
#ls -l
total
-rw-r----- mysql mysql Apr : auto.cnf
-rw-r----- mysql mysql Jul : error.log
-rw-r----- mysql mysql Jul : ib_buffer_pool
-rw-r----- mysql mysql Jul : ibdata1
-rw-r----- mysql mysql Jul : ib_logfile0
-rw-r----- mysql mysql Jul : ib_logfile1
-rw-r----- mysql mysql Jul : ib_logfile2
-rw-r----- mysql mysql Jul : innodb_status.
-rw-r----- mysql mysql Jul : innodb_status.
-rw-r----- mysql mysql Jul : innodb_status.
-rw-r----- mysql mysql Jul : innodb_status.
-rw-r----- mysql mysql Jul : innodb_status.
-rw-r----- mysql mysql Jul : innodb_status.
-rw-r----- mysql mysql Jun : innodb_status.
drwxr-x--- mysql mysql Jul : mysql
drwxr-x--- mysql mysql Apr : performance_schema
-rw-r----- mysql mysql Jul : relay-bin.
-rw-r----- mysql mysql Jul : relay-bin.
-rw-r----- mysql mysql Jul : relay-bin.
-rw-r----- mysql mysql Jun : relay-bin-group_replication_applier.
-rw-r----- mysql mysql Jun : relay-bin-group_replication_applier.
-rw-r----- mysql mysql Jun : relay-bin-group_replication_applier.
-rw-r----- mysql mysql Jun : relay-bin-group_replication_applier.
-rw-r----- mysql mysql Jun : relay-bin-group_replication_applier.
-rw-r----- mysql mysql Jun : relay-bin-group_replication_applier.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_applier.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_applier.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_applier.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_applier.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_applier.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_applier.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_applier.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_applier.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_applier.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_applier.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_applier.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_applier.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_applier.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_applier.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_applier.index
-rw-r----- mysql mysql Jun : relay-bin-group_replication_recovery.
-rw-r----- mysql mysql Jun : relay-bin-group_replication_recovery.
-rw-r----- mysql mysql Jun : relay-bin-group_replication_recovery.
-rw-r----- mysql mysql Jun : relay-bin-group_replication_recovery.
-rw-r----- mysql mysql Jun : relay-bin-group_replication_recovery.
-rw-r----- mysql mysql Jun : relay-bin-group_replication_recovery.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_recovery.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_recovery.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_recovery.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_recovery.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_recovery.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_recovery.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_recovery.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_recovery.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_recovery.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_recovery.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_recovery.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_recovery.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_recovery.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_recovery.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_recovery.index
-rw-r----- mysql mysql Jul : relay-bin.index
-rw-r----- mysql mysql Jul : slow.log
drwxr-x--- mysql mysql Apr : sys
drwxr-x--- mysql mysql Jul : zlm
-rw-r----- mysql mysql Jul : zlm3.log [root@zlm3 :: /data/mysql/mysql3306/data]
#rm -rf * [root@zlm3 :: /data/mysql/mysql3306/data]
#ls -l
total [root@zlm3 :: /data/mysql/mysql3306/data]
#innobackupex --defaults-file=/data/mysql/mysql3306/my.cnf --copy-back /data/backup/--25_04--/
xtrabackup: recognized server arguments: --datadir=/data/mysql/mysql3306/data --tmpdir=/data/mysql/mysql3306/tmp --open_files_limit= --server-id= --log_bin=/data/mysql/mysql3306/logs/mysql-bin --innodb_buffer_pool_size=100M --innodb_data_file_path=ibdata1:100M:autoextend --innodb_flush_log_at_trx_commit= --innodb_log_buffer_size=8M --innodb_log_file_size=100M --innodb_log_files_in_group= --innodb_max_dirty_pages_pct= --innodb_file_per_table= --innodb_io_capacity= --innodb_flush_method=O_DIRECT --server-id=
xtrabackup: recognized client arguments: --datadir=/data/mysql/mysql3306/data --tmpdir=/data/mysql/mysql3306/tmp --open_files_limit= --server-id= --log_bin=/data/mysql/mysql3306/logs/mysql-bin --innodb_buffer_pool_size=100M --innodb_data_file_path=ibdata1:100M:autoextend --innodb_flush_log_at_trx_commit= --innodb_log_buffer_size=8M --innodb_log_file_size=100M --innodb_log_files_in_group= --innodb_max_dirty_pages_pct= --innodb_file_per_table= --innodb_io_capacity= --innodb_flush_method=O_DIRECT --server-id=
:: innobackupex: Starting the copy-back operation IMPORTANT: Please check that the copy-back run completes successfully.
At the end of a successful copy-back run innobackupex
prints "completed OK!". innobackupex version 2.4. based on MySQL server 5.7. Linux (x86_64) (revision id: 170eb8c)
:: [] Copying ib_logfile0 to /data/mysql/mysql3306/data/ib_logfile0
:: [] ...done
:: [] Copying ib_logfile1 to /data/mysql/mysql3306/data/ib_logfile1
:: [] ...done
:: [] Copying ib_logfile2 to /data/mysql/mysql3306/data/ib_logfile2
:: [] ...done
:: [] Copying ibdata1 to /data/mysql/mysql3306/data/ibdata1
:: [] ...done
:: [] Copying ./mysql/plugin.ibd to /data/mysql/mysql3306/data/mysql/plugin.ibd
:: [] ...done
:: [] Copying ./mysql/servers.ibd to /data/mysql/mysql3306/data/mysql/servers.ibd
:: [] ...done
:: [] Copying ./mysql/help_topic.ibd to /data/mysql/mysql3306/data/mysql/help_topic.ibd
:: [] ...done
:: [] Copying ./mysql/help_category.ibd to /data/mysql/mysql3306/data/mysql/help_category.ibd
:: [] ...done
:: [] Copying ./mysql/help_relation.ibd to /data/mysql/mysql3306/data/mysql/help_relation.ibd
:: [] ...done
:: [] Copying ./mysql/help_keyword.ibd to /data/mysql/mysql3306/data/mysql/help_keyword.ibd
:: [] ...done
:: [] Copying ./mysql/time_zone_name.ibd to /data/mysql/mysql3306/data/mysql/time_zone_name.ibd
:: [] ...done
:: [] Copying ./mysql/time_zone.ibd to /data/mysql/mysql3306/data/mysql/time_zone.ibd
:: [] ...done
:: [] Copying ./mysql/time_zone_transition.ibd to /data/mysql/mysql3306/data/mysql/time_zone_transition.ibd
:: [] ...done
:: [] Copying ./mysql/time_zone_transition_type.ibd to /data/mysql/mysql3306/data/mysql/time_zone_transition_type.ibd
:: [] ...done
:: [] Copying ./mysql/time_zone_leap_second.ibd to /data/mysql/mysql3306/data/mysql/time_zone_leap_second.ibd
:: [] ...done
:: [] Copying ./mysql/innodb_table_stats.ibd to /data/mysql/mysql3306/data/mysql/innodb_table_stats.ibd
:: [] ...done
:: [] Copying ./mysql/innodb_index_stats.ibd to /data/mysql/mysql3306/data/mysql/innodb_index_stats.ibd
:: [] ...done
:: [] Copying ./mysql/slave_relay_log_info.ibd to /data/mysql/mysql3306/data/mysql/slave_relay_log_info.ibd
:: [] ...done
:: [] Copying ./mysql/slave_master_info.ibd to /data/mysql/mysql3306/data/mysql/slave_master_info.ibd
:: [] ...done
:: [] Copying ./mysql/slave_worker_info.ibd to /data/mysql/mysql3306/data/mysql/slave_worker_info.ibd
:: [] ...done
:: [] Copying ./mysql/gtid_executed.ibd to /data/mysql/mysql3306/data/mysql/gtid_executed.ibd
:: [] ...done
:: [] Copying ./mysql/server_cost.ibd to /data/mysql/mysql3306/data/mysql/server_cost.ibd
:: [] ...done
:: [] Copying ./mysql/engine_cost.ibd to /data/mysql/mysql3306/data/mysql/engine_cost.ibd
:: [] ...done
:: [] Copying ./mysql/db.opt to /data/mysql/mysql3306/data/mysql/db.opt
:: [] ...done
:: [] Copying ./mysql/db.frm to /data/mysql/mysql3306/data/mysql/db.frm
:: [] ...done
:: [] Copying ./mysql/db.MYI to /data/mysql/mysql3306/data/mysql/db.MYI
:: [] ...done
:: [] Copying ./mysql/db.MYD to /data/mysql/mysql3306/data/mysql/db.MYD
:: [] ...done
:: [] Copying ./mysql/user.frm to /data/mysql/mysql3306/data/mysql/user.frm
:: [] ...done
:: [] Copying ./mysql/user.MYI to /data/mysql/mysql3306/data/mysql/user.MYI
:: [] ...done
:: [] Copying ./mysql/user.MYD to /data/mysql/mysql3306/data/mysql/user.MYD
:: [] ...done //A bundle of copying operations are omitted. :: [] Copying ./ib_buffer_pool to /data/mysql/mysql3306/data/ib_buffer_pool
:: [] ...done
:: [] Copying ./xtrabackup_info to /data/mysql/mysql3306/data/xtrabackup_info
:: [] ...done
:: [] Copying ./xtrabackup_binlog_pos_innodb to /data/mysql/mysql3306/data/xtrabackup_binlog_pos_innodb
:: [] ...done
:: [] Copying ./xtrabackup_master_key_id to /data/mysql/mysql3306/data/xtrabackup_master_key_id
:: [] ...done
:: [] Copying ./ibtmp1 to /data/mysql/mysql3306/data/ibtmp1
:: [] ...done
:: completed OK! //Notice to do the operation above after shutting dowd the MySQL instance.
//If the copy back operations show errors,we can copy them directly with the OS command into the target directory.
Restart the mysqld again.
 [root@zlm3 :: /data/mysql/mysql3306/data]
#sh /root/mysqld.sh [root@zlm3 :: /data/mysql/mysql3306/data]
#ps aux|grep mysqld
root 0.0 0.0 pts/ R+ : : grep --color=auto mysqld [root@zlm3 :: /data/mysql/mysql3306/data]
#tail error.log
--25T04::14.875825+: [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable //"ibdata1" is unwritable,we should check the privilege of ownership.
--25T04::14.875859+: [ERROR] InnoDB: Plugin initialization aborted with error Generic error
--25T04::15.480834+: [ERROR] Plugin 'InnoDB' init function returned error.
--25T04::15.480867+: [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
--25T04::15.480878+: [ERROR] Failed to initialize builtin plugins.
--25T04::15.480882+: [ERROR] Aborting --25T04::15.480888+: [Note] Binlog end
--25T04::15.481278+: [Note] mysqld: Shutdown complete [root@zlm3 :: /data/mysql/mysql3306/data]
#ls -l
total
-rw-r----- mysql mysql Jul : error.log
-rw-r----- root root Jul : ib_buffer_pool
-rw-r----- root root Jul : ibdata1
-rw-r----- root root Jul : ib_logfile0
-rw-r----- root root Jul : ib_logfile1
-rw-r----- root root Jul : ib_logfile2
-rw-r----- root root Jul : ibtmp1
-rw-r----- mysql mysql Jul : innodb_status.
drwxr-x--- root root Jul : mysql
drwxr-x--- root root Jul : performance_schema
drwxr-x--- root root Jul : sys
-rw-r----- root root Jul : xtrabackup_binlog_pos_innodb
-rw-r----- root root Jul : xtrabackup_info
-rw-r----- root root Jul : xtrabackup_master_key_id
drwxr-x--- root root Jul : zlm [root@zlm3 :: /data/mysql/mysql3306/data]
#chown -R mysql.mysql * [root@zlm3 :: /data/mysql/mysql3306/data]
#ls -l
total
-rw-r----- mysql mysql Jul : error.log
-rw-r----- mysql mysql Jul : ib_buffer_pool
-rw-r----- mysql mysql Jul : ibdata1
-rw-r----- mysql mysql Jul : ib_logfile0
-rw-r----- mysql mysql Jul : ib_logfile1
-rw-r----- mysql mysql Jul : ib_logfile2
-rw-r----- mysql mysql Jul : ibtmp1
-rw-r----- mysql mysql Jul : innodb_status.
drwxr-x--- mysql mysql Jul : mysql
drwxr-x--- mysql mysql Jul : performance_schema
drwxr-x--- mysql mysql Jul : sys
-rw-r----- mysql mysql Jul : xtrabackup_binlog_pos_innodb
-rw-r----- mysql mysql Jul : xtrabackup_info
-rw-r----- mysql mysql Jul : xtrabackup_master_key_id
drwxr-x--- mysql mysql Jul : zlm [root@zlm3 :: /data/mysql/mysql3306/data]
#sh /root/mysqld.sh [root@zlm3 :: /data/mysql/mysql3306/data]
#ps aux|grep mysqld
mysql 4.6 17.8 pts/ Sl : : mysqld --defaults-file=/data/mysql/mysql3306/my.cnf
root 0.0 0.0 pts/ R+ : : grep --color=auto mysqld [root@zlm3 :: /data/mysql/mysql3306/data]
#tail error.log
--25T04::15.319399+: [Note] - '::' resolves to '::';
--25T04::15.319419+: [Note] Server socket created on IP: '::'.
--25T04::15.476741+: [Note] InnoDB: Buffer pool(s) load completed at ::
--25T04::15.514597+: [Note] Relay log recovery skipped for group replication channel.
--25T04::15.514661+: [Warning] Recovery from master pos and file for channel 'group_replication_applier'. Previous relay log pos and relay log file had been set to , ./relay-bin-group_replication_applier. respectively.
--25T04::15.522471+: [Note] Relay log recovery skipped for group replication channel.
--25T04::15.522493+: [Warning] Recovery from master pos and file for channel 'group_replication_recovery'. Previous relay log pos and relay log file had been set to , ./relay-bin-group_replication_recovery. respectively.
--25T04::15.579447+: [Note] Event Scheduler: Loaded events
--25T04::15.579569+: [Note] mysqld: ready for connections. //It's okay now.
Version: '5.7.21-log' socket: '/tmp/mysql3306.sock' port: MySQL Community Server (GPL)
Check the GTID information on slave.
 [root@zlm3 :: /data/mysql/mysql3306/data]
#mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.7.-log MySQL Community Server (GPL) Copyright (c) , , Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. (zlm@192.168.1.102 )[(none)]>show master status;
+------------------+----------+--------------+------------------+------------------------------------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+------------------------------------------------+
| mysql-bin. | | | | 1b7181ee-6eaf-11e8-998e-080027de0e0e:- |
+------------------+----------+--------------+------------------+------------------------------------------------+
row in set (0.00 sec) //Let's compare the GTID information with master.
(zlm@192.168.1.101 )[(none)]>show master status;
+------------------+----------+--------------+------------------+------------------------------------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+------------------------------------------------+
| mysql-bin. | | | | 1b7181ee-6eaf-11e8-998e-080027de0e0e:- |
+------------------+----------+--------------+------------------+------------------------------------------------+
row in set (0.00 sec) //The "Executed_Gtid_Set" are equal,it's "uuid:1-3730021".
Execute "change master to ... " to impement a slave based on GTID.
 
 (zlm@192.168.1.102 )[(none)]>show slave status\G
Empty set (0.00 sec) (zlm@192.168.1.102 )[(none)]>change master to \
-> master_host='192.168.1.101'\
-> master_port=\
-> ^C
(zlm@192.168.1.102 )[(none)]>
(zlm@192.168.1.102 )[(none)]>change master to \
-> master_host='192.168.1.101',\
-> master_port=,\
-> master_user='repl',\
-> master_password='repl4slave',\
-> master_auto_position=;
Query OK, rows affected, warnings (0.02 sec) (zlm@192.168.1.102 )[(none)]>show warnings;
+-------+------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Level | Code | Message |
+-------+------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Note | | Sending passwords in plain text without SSL/TLS is extremely insecure. |
| Note | | Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. |
+-------+------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
rows in set (0.00 sec) (zlm@192.168.1.102 )[(none)]>show slave status\G
*************************** . row ***************************
Slave_IO_State:
Master_Host: 192.168.1.101
Master_User: repl
Master_Port:
Connect_Retry:
Master_Log_File:
Read_Master_Log_Pos:
Relay_Log_File: relay-bin.
Relay_Log_Pos:
Relay_Master_Log_File:
Slave_IO_Running: No
Slave_SQL_Running: No
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno:
Last_Error:
Skip_Counter:
Exec_Master_Log_Pos:
Relay_Log_Space:
Until_Condition: None
Until_Log_File:
Until_Log_Pos:
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno:
Last_IO_Error:
Last_SQL_Errno:
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id:
Master_UUID:
Master_Info_File: mysql.slave_master_info
SQL_Delay:
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State:
Master_Retry_Count:
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set: 1b7181ee-6eaf-11e8-998e-080027de0e0e:-
Auto_Position:
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
row in set (0.00 sec) (zlm@192.168.1.102 )[(none)]>start slave;
Query OK, rows affected (0.00 sec) (zlm@192.168.1.102 )[(none)]>show slave status\G
*************************** . row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.1.101
Master_User: repl
Master_Port:
Connect_Retry:
Master_Log_File: mysql-bin.
Read_Master_Log_Pos:
Relay_Log_File: relay-bin.
Relay_Log_Pos:
Relay_Master_Log_File: mysql-bin.
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:
Last_Error:
Skip_Counter:
Exec_Master_Log_Pos:
Relay_Log_Space:
Until_Condition: None
Until_Log_File:
Until_Log_Pos:
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master:
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno:
Last_IO_Error:
Last_SQL_Errno:
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id:
Master_UUID: 1b7181ee-6eaf-11e8-998e-080027de0e0e
Master_Info_File: mysql.slave_master_info
SQL_Delay:
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
Master_Retry_Count:
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set: 1b7181ee-6eaf-11e8-998e-080027de0e0e:-
Auto_Position:
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
row in set (0.00 sec)
Summary
  • Xtrabackup is a physical backup tool of MySQL.It provides incremental backup of innodb engine based on redo logfile.
  • innobackupex is a soft link of xtrabackup.It needs three steps to restore a instance on slave server(backup,apply-log,copy-back).
  • Before you do the copy-back operation,the instance should be shudown first and the target data directory should be empty.
  • If your database is tremendous,It's a better way to implement a new slave with Xtrabckup instead of mysqldump.
 

利用Xtrabackup搭建GTID主从复制(一主一从)的更多相关文章

  1. MySQL(14)---Docker搭建MySQL主从复制(一主一从)

    Docker搭建MySQL主从复制(一主一从) 上一篇博客写了MYSQL主从复制原理 : MySQL(13)---MYSQL主从复制原理 这篇我们来写 Docker搭建MYSQL主从复制(一主一从) ...

  2. XtraBackup 搭建从库的一般步骤及 XtraBackup 8.0 的注意事项

    搭建从库,本质上需要的只是一个一致性备份集及这个备份集对应的位置点信息.之前介绍的几个备份工具(MySQL中如何选择合适的备份策略和备份工具)均可满足. 这里,我们重点看看如何基于 XtraBacku ...

  3. 利用xtraBackup实现不停master服务做主从同步

    MySQL主从同步原理: MySQL主从同步是在MySQL主从复制(Master-Slave Replication)基础上实现的,通过设置在Master MySQL上的binlog(使其处于打开状态 ...

  4. Centos7.5部署MySQL5.7基于GTID主从复制+并行复制+半同步复制+读写分离(ProxySQL) 环境- 运维笔记 (完整版)

    之前已经详细介绍了Mysql基于GTID主从复制的概念,原理和配置,下面整体记录下MySQL5.7基于GTID主从复制+并行复制+增强半同步复制+读写分离环境的实现过程,以便加深对mysql新特性GT ...

  5. Kafka1 利用虚拟机搭建自己的Kafka集群

    前言:       上周末自己学习了一下Kafka,参考网上的文章,学习过程中还是比较顺利的,遇到的一些问题最终也都解决了,现在将学习的过程记录与此,供以后自己查阅,如果能帮助到其他人,自然是更好的. ...

  6. ZooKeeper1 利用虚拟机搭建自己的ZooKeeper集群

    前言:       前段时间自己参考网上的文章,梳理了一下基于分布式环境部署的业务系统在解决数据一致性问题上的方案,其中有一个方案是使用ZooKeeper,加之在大数据处理中,ZooKeeper确实起 ...

  7. Hadoop4 利用VMware搭建自己的hadoop集群

    前言:       前段时间自己学习如何部署伪分布式模式的hadoop环境,之前由于工作比较忙,学习的进度停滞了一段时间,所以今天抽出时间把最近学习的成果和大家分享一下.       本文要介绍的是如 ...

  8. 利用Hexo搭建个人博客-博客发布篇

    通过 <利用Hexo搭建个人博客-环境搭建篇> 以及 <利用Hexo搭建个人博客-博客初始化篇>,我们了解到了利用Hexo搭建个人博客需要的环境以及配置,下面这篇文章将会介绍如 ...

  9. 利用Hexo搭建个人博客-博客初始化篇

    上一篇博文 <利用Hexo搭建个人博客-环境搭建篇> 中,我们讲解了利用Hexo搭建个人博客应该要配置哪些环境.相信大家已经迫不及待的想要知道接下来应该要怎么把自己的博客搭起来了,下面,让 ...

随机推荐

  1. PHP @ at 记号的作用

    看PHP的代码,总有些行前边有@符号,一直不知道是什么意思. 例如dede5.7     @$ni=imagecreatetruecolor($ftoW,$ftoH); 今天用到了,就记一下吧.其实它 ...

  2. BZOJ 4247 挂饰 01背包

    题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=4247 JOI君有N个装在手机上的挂饰,编号为1...N. JOI君可以将其中的一些装在手机 ...

  3. Codeblocks的常用Debug快捷键

    1.在鼠标处开始Debug,F4. 2.逐步调试,F7. 3.进入函数,shift+F7. 4.结束Debug,shift+F8.

  4. spring依赖注入(转)

    转自:https://blog.csdn.net/taijianyu/article/details/2338311/ Spring 能有效地组织J2EE应用各层的对象.不管是控 制层的Action对 ...

  5. 使用QT开发GoogleMap瓦片显示和下载工具(1)——QT开发环境准备

    由于是第一次使用qt,光是QT的安装和调试就费了好大功夫,汗一个,下面记录下过程和遇到的问题的解决方法吧. 下载QT 直接Google搜索“QT”,进入官网http://qt-project.org/ ...

  6. apache配置局域网访问

    1.配置vhost.conf NameVirtualHost 192.168.2.74:80 <VirtualHost 192.168.2.74:80> DocumentRoot /var ...

  7. 线程池,多线程,线程异步,同步和死锁,Lock接口

    线程池 线程池,其实就是一个容纳多个线程的容器,其中的线程可以反复使用,省去了频繁创建线程对象的操作,无需反复创建线程而消耗过多资源. 除了创建和销毁线程的开销之外,活动的线程也需要消耗系统资源.线程 ...

  8. C#流程控制语句

    C#流程控制语句 一.选择语句 当程序中需要进行两个或两个以上的选择时,可以根据条件的判断来选择将要执行的一组语句. ?if语句 ?switch语句 二.循环语句 循环语句是对一个程序模块进行的重复操 ...

  9. 使用Mac的过程中的一些小操作

    前言:使用Mac的过程中的一些小操作 查看Mac系统是32位还是64位: 方法1: 点击左上角的苹果按钮->关于本机->概览->系统报告->软件->偏好设置面板:右侧有提 ...

  10. vue中登录模块的插件封装

    一个电商城的项目,场景是:在未登录的情况下点击收藏或者加入购物车等操作,执行一个方法如this.$login()来动态插入登录组件. 第一步:写好关于这个登录弹窗的单文件组件 loginBox.vue ...