xtrabackup搭建MySQL 8.0 主从复制

xtrabackup搭建MySQL 8.0 主从复制

  • 安装MySQL 8.0.37
  • 安装xtrabackup
  • GTIDs
  • 初始化从库
  • 参考:
  • GTID概述
  • GTID相较与传统复制的优势
  • GTID自身存在哪些限制
  • GTID工作原理简单介绍
  • 如何开启GTID复制
  • GTID与传统模式建立复制时候语句的不同点
    • 传统复制
    • GTID复制
  • GTID同步状态简单解析

本次搭建的环境信息如下:
OS版本:Red Hat Enterprise Linux Server release 7.6 (Maipo)
MySQL版本:Server version: 8.0.37
xtrabackup版本:xtrabackup version 8.0.35-31 based on MySQL server 8.0.35 Linux (x86_64) (revision id: 55ec21d7)
在这里插入图片描述
本次采用物理备份和还原的方式来进行主从复制的初始化,相比于mysqldump,本方案适合数据量比较大的情况下,初始化很快,而且不像mysqldump的方式,从库不需要先进行初始化。

安装MySQL 8.0.37

groupadd mysql
useradd -g mysql -s /sbin/nologin -d /usr/local/mysql -MN mysql
cd /opt
unxz mysql-8.0.37-linux-glibc2.17-x86_64.tar.xz 
tar -xvf mysql-8.0.37-linux-glibc2.17-x86_64.tar 
cd /usr/local
ln -s /opt/mysql-8.0.37-linux-glibc2.17-x86_64 mysql
chown -R mysql:mysql /usr/local/mysql/
mkdir -p /data/mysql/mysql3306/{data,logs,tmp}
mv /opt/my.cnf /data/mysql/mysql3306/my3306.cnf
chown -R mysql:mysql /usr/local/mysql/
chown -R mysql:mysql /data/mysql/mysql3306//usr/local/mysql/bin/mysqld --defaults-file=/data/mysql/mysql3306/my3306.cnf --initialize
/usr/local/mysql/bin/mysqld --defaults-file=/data/mysql/mysql3306/my3306.cnf &/usr/local/mysql/bin/mysql -uroot -p -S /tmp/mysql3306.sock
alter user user() identified by 'mysql';

安装xtrabackup

xtrabackup是社区开源产品。但是它不是MySQL自带的工具,需要我们自己进行安装。下面就说下安装过程
1、 下载安装包
由于xtrabackup有版本的区别,根据最佳实践,我们安装的MySQL版本为8.0.37,xtrabackup选择8.0以上最新版本即可,不选择2.4的版本,rpm安装,方便简单。
下载地址:https://www.percona.com/downloads

在这里插入图片描述

version:选择最新的
software:选择rpm,就选RHELx。如果是二进制,就选 Linux-Generic
2、安装,为了解决软件依赖问题,采用yum localinstall来安装
在这里插入图片描述
缺两个包:zstd和libev.so.4()(64bit),镜像里面没有这两个包,我们手动下载匹配版本进行安装:

# rpm -ivh libev-4.15-7.el7.x86_64.rpm 
# rpm -ivh zstd-1.5.5-1.el7.x86_64.rpm

重新安装成功

[root@postgre opt]# yum localinstall percona-xtrabackup-80-8.0.35-31.1.el7.x86_64.rpm 
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Examining percona-xtrabackup-80-8.0.35-31.1.el7.x86_64.rpm: percona-xtrabackup-80-8.0.35-31.1.el7.x86_64
Marking percona-xtrabackup-80-8.0.35-31.1.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package percona-xtrabackup-80.x86_64 0:8.0.35-31.1.el7 will be installed
--> Processing Dependency: perl(DBD::mysql) for package: percona-xtrabackup-80-8.0.35-31.1.el7.x86_64
--> Processing Dependency: perl(Digest::MD5) for package: percona-xtrabackup-80-8.0.35-31.1.el7.x86_64
--> Running transaction check
---> Package perl-DBD-MySQL.x86_64 0:4.023-6.el7 will be installed
---> Package perl-Digest-MD5.x86_64 0:2.52-3.el7 will be installed
--> Processing Dependency: perl(Digest::base) >= 1.00 for package: perl-Digest-MD5-2.52-3.el7.x86_64
--> Running transaction check
---> Package perl-Digest.noarch 0:1.17-245.el7 will be installed
--> Finished Dependency ResolutionDependencies Resolved==========================================================================================================================================================================================Package                                     Arch                         Version                               Repository                                                           Size
==========================================================================================================================================================================================
Installing:percona-xtrabackup-80                       x86_64                       8.0.35-31.1.el7                       /percona-xtrabackup-80-8.0.35-31.1.el7.x86_64                       219 M
Installing for dependencies:perl-DBD-MySQL                              x86_64                       4.023-6.el7                           base                                                                140 kperl-Digest                                 noarch                       1.17-245.el7                          base                                                                 23 kperl-Digest-MD5                             x86_64                       2.52-3.el7                            base                                                                 30 kTransaction Summary
==========================================================================================================================================================================================
Install  1 Package (+3 Dependent packages)Total size: 219 M
Total download size: 193 k
Installed size: 219 M
Is this ok [y/d/N]: y
Downloading packages:
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                     464 kB/s | 193 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.Installing : perl-DBD-MySQL-4.023-6.el7.x86_64                                                                                                                                      1/4 Installing : perl-Digest-1.17-245.el7.noarch                                                                                                                                        2/4 Installing : perl-Digest-MD5-2.52-3.el7.x86_64                                                                                                                                      3/4 Installing : percona-xtrabackup-80-8.0.35-31.1.el7.x86_64                                                                                                                           4/4 
base/productid                                                                                                                                                     | 1.6 kB  00:00:00     Verifying  : perl-Digest-1.17-245.el7.noarch                                                                                                                                        1/4 Verifying  : perl-Digest-MD5-2.52-3.el7.x86_64                                                                                                                                      2/4 Verifying  : percona-xtrabackup-80-8.0.35-31.1.el7.x86_64                                                                                                                           3/4 Verifying  : perl-DBD-MySQL-4.023-6.el7.x86_64                                                                                                                                      4/4 Installed:percona-xtrabackup-80.x86_64 0:8.0.35-31.1.el7                                                                                                                                          Dependency Installed:perl-DBD-MySQL.x86_64 0:4.023-6.el7                           perl-Digest.noarch 0:1.17-245.el7                           perl-Digest-MD5.x86_64 0:2.52-3.el7                          Complete!
xtrabackup version 8.0.35-31 based on MySQL server 8.0.35 Linux (x86_64) (revision id: 55ec21d7)

GTIDs

搭建复制最基础的参数:
| gtid_mode | ON |
| binlog_format | ROW |
那么GTID是什么东西哪?为什么在复制环境中这么重要?
他其实就是一串数字,给每个事务做个唯一标识,一般表示为:server_uuid:transaction_id,如:8e14e45d-4ff1-11ef-9808-000c29e3c118:1-6 。其中UUID(即server_uuid) 存于文件:

[root@postgre data]# cat /data/mysql/mysql3306/data/auto.cnf 
[auto]
server-uuid=f25d3a39-53a2-11ef-9508-000c29a318a4

是一个MySQL实例的唯一标识。TID代表了该实例上已经提交的事务数量,并且随着事务提交单调递增,所以GTID能够保证每个MySQL实例事务的执行(不会重复执行同一个事务,并且会补全没有执行的事务)。GTID在一组复制中,全局唯一。
GTID用来代替传统复制方法,不再使用MASTER_LOG_FILE+MASTER_LOG_POS开启复制。 而是使用MASTER_AUTO_POSTION=1的方式开始复制;从服务器连接到主服务器之后,把自己执行过的GTID (Executed_Gtid_Set: 即已经执行的事务编码)<SQL线程> 、获取到的GTID (Retrieved_Gtid_Set: 即从库已经接收到主库的事务编号) <IO线程>发给主服务器,主服务器把从服务器缺少的GTID及对应的transactions发过去补全即可。当主服务器挂掉的时候,找出同步最成功的那台从服务器,直接把它提升为主即可。如果硬要指定某一台不是最新的从服务器提升为主, 先change到同步最成功的那台从服务器, 等把GTID全部补全了,就可以把它提升为主了。

GTID是用区间来表示的事务:
第一个事务:8e14e45d-4ff1-11ef-9808-000c29e3c118:1
第二个事务:8e14e45d-4ff1-11ef-9808-000c29e3c118:1-2
第三个事务:8e14e45d-4ff1-11ef-9808-000c29e3c118:1-3
原则上来讲,主从结构的GTIDs是连续的,如果从库上的GTID是不连续,那么肯定就是丢数据了。
既然开启GTID较之前有很多的优势,那么在5.7值后,我们一般都建议开启GTID进行复制。

初始化从库

[root@postgre data]# xtrabackup --defaults-file=/data/mysql/mysql3306/my3306.cnf -S /tmp/mysql3306.sock -uroot -p --backup --target-dir=/data/backup/db3306_full
2024-08-06T13:54:21.177384+08:00 0 [Note] [MY-011825] [Xtrabackup] recognized server arguments: --server-id=3306 --datadir=/data/mysql/mysql3306/data --open_files_limit=65535 --log_bin=/data/mysql/mysql3306/data/mybinlog --innodb_buffer_pool_size=100M --innodb_data_file_path=ibdata1:12M:autoextend --innodb_flush_log_at_trx_commit=1 --innodb_log_buffer_size=32M --innodb_log_file_size=1G --innodb_log_files_in_group=3 --innodb_io_capacity=4000 --innodb_open_files=65535 --innodb_flush_method=O_DIRECT --innodb_adaptive_hash_index=0 --innodb_adaptive_hash_index=0 
2024-08-06T13:54:21.177553+08:00 0 [Note] [MY-011825] [Xtrabackup] recognized client arguments: --port=3306 --socket=/tmp/mysql3306.sock --socket=/tmp/mysql3306.sock --user=root --password --backup=1 --target-dir=/data/backup/db3306_full 
Enter password: 
xtrabackup version 8.0.35-31 based on MySQL server 8.0.35 Linux (x86_64) (revision id: 55ec21d7)
240806 13:54:23  version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;port=3306;mysql_socket=/tmp/mysql3306.sock' as 'root'  (using password: YES).
Failed to connect to MySQL server: DBI connect(';mysql_read_default_group=xtrabackup;port=3306;mysql_socket=/tmp/mysql3306.sock','root',...) failed: Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib64/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory at - line 1535.
2024-08-06T13:54:23.640205+08:00 0 [Note] [MY-011825] [Xtrabackup] Connecting to MySQL server host: localhost, user: root, password: set, port: 3306, socket: /tmp/mysql3306.sock
2024-08-06T13:54:23.655405+08:00 0 [Note] [MY-011825] [Xtrabackup] Using server version 8.0.37
2024-08-06T13:54:23.681865+08:00 0 [Note] [MY-011825] [Xtrabackup] Executing LOCK INSTANCE FOR BACKUP ...
2024-08-06T13:54:23.682950+08:00 0 [Note] [MY-011825] [Xtrabackup] uses posix_fadvise().
2024-08-06T13:54:23.682988+08:00 0 [Note] [MY-011825] [Xtrabackup] cd to /data/mysql/mysql3306/data
2024-08-06T13:54:23.683006+08:00 0 [Note] [MY-011825] [Xtrabackup] open files limit requested 65535, set to 65535
........
performance_schema/keyring_componen_191.sdi to /data/backup/db3306_full/performance_schema/keyring_componen_191.sdi
2024-08-06T13:54:25.828058+08:00 0 [Note] [MY-011825] [Xtrabackup] Finished backing up non-InnoDB tables and files
2024-08-06T13:54:25.828098+08:00 0 [Note] [MY-011825] [Xtrabackup] Executing FLUSH NO_WRITE_TO_BINLOG BINARY LOGS
2024-08-06T13:54:25.884799+08:00 0 [Note] [MY-011825] [Xtrabackup] Selecting LSN and binary log position from p_s.log_status
2024-08-06T13:54:25.950500+08:00 0 [Note] [MY-011825] [Xtrabackup] Copying /data/mysql/mysql3306/data/mybinlog.000003 to /data/backup/db3306_full/mybinlog.000003 up to position 197
2024-08-06T13:54:25.950570+08:00 0 [Note] [MY-011825] [Xtrabackup] Done: Copying /data/mysql/mysql3306/data/mybinlog.000003 to /data/backup/db3306_full/mybinlog.000003
2024-08-06T13:54:25.951697+08:00 0 [Note] [MY-011825] [Xtrabackup] Writing /data/backup/db3306_full/mybinlog.index
2024-08-06T13:54:25.951768+08:00 0 [Note] [MY-011825] [Xtrabackup] Done: Writing file /data/backup/db3306_full/mybinlog.index
2024-08-06T13:54:25.960548+08:00 0 [Note] [MY-011825] [Xtrabackup] Writing /data/backup/db3306_full/xtrabackup_binlog_info
2024-08-06T13:54:25.960619+08:00 0 [Note] [MY-011825] [Xtrabackup] Done: Writing file /data/backup/db3306_full/xtrabackup_binlog_info
2024-08-06T13:54:25.961518+08:00 0 [Note] [MY-011825] [Xtrabackup] Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS...
2024-08-06T13:54:25.988881+08:00 0 [Note] [MY-011825] [Xtrabackup] The latest check point (for incremental): '20338027'
2024-08-06T13:54:25.988974+08:00 0 [Note] [MY-011825] [Xtrabackup] Stopping log copying thread at LSN 20338027
2024-08-06T13:54:25.991165+08:00 1 [Note] [MY-011825] [Xtrabackup] Starting to parse redo log at lsn = 20337695
2024-08-06T13:54:26.016990+08:00 0 [Note] [MY-011825] [Xtrabackup] Executing UNLOCK INSTANCE
2024-08-06T13:54:26.024865+08:00 0 [Note] [MY-011825] [Xtrabackup] All tables unlocked
2024-08-06T13:54:26.025041+08:00 0 [Note] [MY-011825] [Xtrabackup] Copying ib_buffer_pool to /data/backup/db3306_full/ib_buffer_pool
2024-08-06T13:54:26.025488+08:00 0 [Note] [MY-011825] [Xtrabackup] Done: Copying ib_buffer_pool to /data/backup/db3306_full/ib_buffer_pool
2024-08-06T13:54:26.026709+08:00 0 [Note] [MY-011825] [Xtrabackup] Backup created in directory '/data/backup/db3306_full/'
2024-08-06T13:54:26.026735+08:00 0 [Note] [MY-011825] [Xtrabackup] MySQL binlog position: filename 'mybinlog.000003', position '197', GTID of the last change 'f25d3a39-53a2-11ef-9508-000c29a318a4:1-4'
2024-08-06T13:54:26.036177+08:00 0 [Note] [MY-011825] [Xtrabackup] Writing /data/backup/db3306_full/backup-my.cnf
2024-08-06T13:54:26.036245+08:00 0 [Note] [MY-011825] [Xtrabackup] Done: Writing file /data/backup/db3306_full/backup-my.cnf
2024-08-06T13:54:26.078730+08:00 0 [Note] [MY-011825] [Xtrabackup] Writing /data/backup/db3306_full/xtrabackup_info
2024-08-06T13:54:26.078833+08:00 0 [Note] [MY-011825] [Xtrabackup] Done: Writing file /data/backup/db3306_full/xtrabackup_info
2024-08-06T13:54:27.088852+08:00 0 [Note] [MY-011825] [Xtrabackup] Transaction log of lsn (20338027) to (20338893) was copied.
2024-08-06T13:54:27.319018+08:00 0 [Note] [MY-011825] [Xtrabackup] completed OK!
[root@postgre data]# 

还原
–prepare的过程,为了避免影响原备份文件,可以先把备份文件拷贝到其他路径,进行prepare。

[root@postgre ~]# xtrabackup --prepare --target-dir=/data/backup/db3306_full
2024-08-06T14:05:25.906594+08:00 0 [Note] [MY-011825] [Xtrabackup] recognized server arguments: --innodb_checksum_algorithm=crc32 --innodb_log_checksums=1 --innodb_data_file_path=ibdata1:12M:autoextend --innodb_log_file_size=1073741824 --innodb_page_size=16384 --innodb_undo_directory=./ --innodb_undo_tablespaces=2 --server-id=3306 --innodb_log_checksums=ON --innodb_redo_log_encrypt=0 --innodb_undo_log_encrypt=0 
2024-08-06T14:05:25.906778+08:00 0 [Note] [MY-011825] [Xtrabackup] recognized client arguments: --prepare=1 --target-dir=/data/backup/db3306_full 
xtrabackup version 8.0.35-31 based on MySQL server 8.0.35 Linux (x86_64) (revision id: 55ec21d7)
2024-08-06T14:05:25.906804+08:00 0 [Note] [MY-011825] [Xtrabackup] cd to /data/backup/db3306_full/
2024-08-06T14:05:25.906880+08:00 0 [Note] [MY-011825] [Xtrabackup] This target seems to be not prepared yet.
2024-08-06T14:05:25.920383+08:00 0 [Note] [MY-011825] [Xtrabackup] xtrabackup_logfile detected: size=8388608, start_lsn=(20338027)
2024-08-06T14:05:25.924383+08:00 0 [Note] [MY-011825] [Xtrabackup] using the following InnoDB configuration for recovery:
2024-08-06T14:05:25.924414+08:00 0 [Note] [MY-011825] [Xtrabackup] innodb_data_home_dir = .
2024-08-06T14:05:25.924420+08:00 0 [Note] [MY-011825] [Xtrabackup] innodb_data_file_path = ibdata1:12M:autoextend
2024-08-06T14:05:25.924482+08:00 0 [Note] [MY-011825] [Xtrabackup] innodb_log_group_home_dir = .
2024-08-06T14:05:25.924492+08:00 0 [Note] [MY-011825] [Xtrabackup] innodb_log_files_in_group = 1
2024-08-06T14:05:25.924503+08:00 0 [Note] [MY-011825] [Xtrabackup] innodb_log_file_size = 8388608
2024-08-06T14:05:25.924769+08:00 0 [Note] [MY-011825] [Xtrabackup] inititialize_service_handles suceeded
2024-08-06T14:05:25.925177+08:00 0 [Note] [MY-011825] [Xtrabackup] using the following InnoDB configuration for recovery:
2024-08-06T14:05:25.925192+08:00 0 [Note] [MY-011825] [Xtrabackup] innodb_data_home_dir = .
2024-08-06T14:05:25.925198+08:00 0 [Note] [MY-011825] [Xtrabackup] innodb_data_file_path = ibdata1:12M:autoextend
2024-08-06T14:05:25.925209+08:00 0 [Note] [MY-011825] [Xtrabackup] innodb_log_group_home_dir = .
2024-08-06T14:05:25.925215+08:00 0 [Note] [MY-011825] [Xtrabackup] innodb_log_files_in_group = 1
2024-08-06T14:05:25.925220+08:00 0 [Note] [MY-011825] [Xtrabackup] innodb_log_file_size = 8388608
2024-08-06T14:05:25.925229+08:00 0 [Note] [MY-011825] [Xtrabackup] Starting InnoDB instance for recovery.
2024-08-06T14:05:25.925235+08:00 0 [Note] [MY-011825] [Xtrabackup] Using 104857600 bytes for buffer pool (set by --use-memory parameter)
2024-08-06T14:05:25.925265+08:00 0 [Note] [MY-012932] [InnoDB] PUNCH HOLE support available
2024-08-06T14:05:25.925280+08:00 0 [Note] [MY-012944] [InnoDB] Uses event mutexes
2024-08-06T14:05:25.925286+08:00 0 [Note] [MY-012945] [InnoDB] GCC builtin __atomic_thread_fence() is used for memory barrier
2024-08-06T14:05:25.925296+08:00 0 [Note] [MY-012948] [InnoDB] Compressed tables use zlib 1.2.13
2024-08-06T14:05:25.925464+08:00 0 [Note] [MY-012951] [InnoDB] Using hardware accelerated crc32 and polynomial multiplication.
2024-08-06T14:05:25.925838+08:00 0 [Note] [MY-012203] [InnoDB] Directories to scan './'
2024-08-06T14:05:25.925873+08:00 0 [Note] [MY-012204] [InnoDB] Scanning './'
2024-08-06T14:05:25.928700+08:00 0 [Note] [MY-012208] [InnoDB] Completed space ID check of 5 files.
2024-08-06T14:05:25.929854+08:00 0 [Note] [MY-012955] [InnoDB] Initializing buffer pool, total size = 128.000000M, instances = 1, chunk size =128.000000M 
2024-08-06T14:05:25.936379+08:00 0 [Note] [MY-012957] [InnoDB] Completed initialization of buffer pool
2024-08-06T14:05:26.059786+08:00 0 [Note] [MY-011951] [InnoDB] page_cleaner coordinator priority: -20
2024-08-06T14:05:26.121777+08:00 0 [Note] [MY-011954] [InnoDB] page_cleaner worker priority: -20
2024-08-06T14:05:26.156695+08:00 0 [Note] [MY-011954] [InnoDB] page_cleaner worker priority: -20
2024-08-06T14:05:26.187928+08:00 0 [Note] [MY-011954] [InnoDB] page_cleaner worker priority: -20
2024-08-06T14:05:26.279548+08:00 0 [Note] [MY-013883] [InnoDB] The latest found checkpoint is at lsn = 20338027 in redo log file ./#innodb_redo/#ib_redo0.
2024-08-06T14:05:26.280684+08:00 0 [Note] [MY-012560] [InnoDB] The log sequence number 19876654 in the system tablespace does not match the log sequence number 20338027 in the redo log files!
2024-08-06T14:05:26.280706+08:00 0 [Note] [MY-012551] [InnoDB] Database was not shutdown normally!
2024-08-06T14:05:26.280716+08:00 0 [Note] [MY-012552] [InnoDB] Starting crash recovery.
2024-08-06T14:05:26.291356+08:00 0 [Note] [MY-013086] [InnoDB] Starting to parse redo log at lsn = 20337695, whereas checkpoint_lsn = 20338027 and start_lsn = 20337664
2024-08-06T14:05:26.291382+08:00 0 [Note] [MY-012550] [InnoDB] Doing recovery: scanned up to log sequence number 20338027
2024-08-06T14:05:26.308762+08:00 0 [Note] [MY-013083] [InnoDB] Log background threads are being started...
2024-08-06T14:05:26.565440+08:00 0 [Note] [MY-012532] [InnoDB] Applying a batch of 0 redo log records ...
2024-08-06T14:05:26.565476+08:00 0 [Note] [MY-012535] [InnoDB] Apply batch completed!
2024-08-06T14:05:26.666404+08:00 0 [Note] [MY-013084] [InnoDB] Log background threads are being closed...
2024-08-06T14:05:26.673366+08:00 0 [Note] [MY-013888] [InnoDB] Upgrading redo log: 1032M, LSN=20338027.
2024-08-06T14:05:26.673404+08:00 0 [Note] [MY-012968] [InnoDB] Starting to delete and rewrite redo log files.
2024-08-06T14:05:26.673476+08:00 0 [Note] [MY-011825] [InnoDB] Removing redo log file: ./#innodb_redo/#ib_redo0
2024-08-06T14:05:26.738599+08:00 0 [Note] [MY-011825] [InnoDB] Creating redo log file at ./#innodb_redo/#ib_redo0_tmp with file_id 0 with size 33554432 bytes
2024-08-06T14:05:26.738808+08:00 0 [Note] [MY-013623] [InnoDB] fallocate() failed with errno 95 - falling back to writing NULLs.
2024-08-06T14:05:26.802147+08:00 0 [Note] [MY-011825] [InnoDB] Renaming redo log file from ./#innodb_redo/#ib_redo0_tmp to ./#innodb_redo/#ib_redo0
2024-08-06T14:05:26.808247+08:00 0 [Note] [MY-012893] [InnoDB] New redo log files created, LSN=20338188
2024-08-06T14:05:26.808323+08:00 0 [Note] [MY-013083] [InnoDB] Log background threads are being started...
2024-08-06T14:05:27.065327+08:00 0 [Note] [MY-013252] [InnoDB] Using undo tablespace './undo_001'.
2024-08-06T14:05:27.066124+08:00 0 [Note] [MY-013252] [InnoDB] Using undo tablespace './undo_002'.
2024-08-06T14:05:27.067420+08:00 0 [Note] [MY-012910] [InnoDB] Opened 2 existing undo tablespaces.
2024-08-06T14:05:27.067537+08:00 0 [Note] [MY-011980] [InnoDB] GTID recovery trx_no: 1567
2024-08-06T14:05:27.113147+08:00 0 [Note] [MY-013777] [InnoDB] Time taken to initialize rseg using 1 thread: 38436 ms.
2024-08-06T14:05:27.116099+08:00 0 [Note] [MY-012923] [InnoDB] Creating shared tablespace for temporary tables
2024-08-06T14:05:27.116255+08:00 0 [Note] [MY-012265] [InnoDB] Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2024-08-06T14:05:27.135449+08:00 0 [Note] [MY-012266] [InnoDB] File './ibtmp1' size is now 12 MB.
2024-08-06T14:05:27.135653+08:00 0 [Note] [MY-013627] [InnoDB] Scanning temp tablespace dir:'./#innodb_temp/'
2024-08-06T14:05:27.148888+08:00 0 [Note] [MY-013018] [InnoDB] Created 128 and tracked 128 new rollback segment(s) in the temporary tablespace. 128 are now active.
2024-08-06T14:05:27.180331+08:00 0 [Note] [MY-012976] [InnoDB] 8.0.35 started; log sequence number 20338198
2024-08-06T14:05:27.180953+08:00 0 [Warning] [MY-012091] [InnoDB] Allocated tablespace ID 1 for sys/sys_config, old maximum was 0
2024-08-06T14:05:27.181888+08:00 0 [Note] [MY-011825] [Xtrabackup] Completed loading of 3 tablespaces into cache in 0.00126516 seconds
2024-08-06T14:05:27.205447+08:00 0 [Note] [MY-011825] [Xtrabackup] Time taken to build dictionary: 0.0235197 seconds
2024-08-06T14:05:27.249975+08:00 0 [Note] [MY-011825] [Xtrabackup] starting shutdown with innodb_fast_shutdown = 1
2024-08-06T14:05:27.250190+08:00 0 [Note] [MY-012330] [InnoDB] FTS optimize thread exiting.
2024-08-06T14:05:28.227326+08:00 0 [Note] [MY-013072] [InnoDB] Starting shutdown...
2024-08-06T14:05:28.332511+08:00 0 [Note] [MY-013084] [InnoDB] Log background threads are being closed...
2024-08-06T14:05:28.349406+08:00 0 [Note] [MY-012980] [InnoDB] Shutdown completed; log sequence number 20338198
2024-08-06T14:05:28.356359+08:00 0 [Note] [MY-011825] [Xtrabackup] completed OK!

–copy-back,此处是把文件从备份处拷贝到datadir下,所以指定了3308的配置文件,里面有datadir具体的路径。

[root@postgre db3306_full]# xtrabackup --defaults-file=/data/mysql/mysql3308/my3308.cnf --copy-back --target-dir=/data/backup/db3306_full/
2024-08-06T14:10:35.140533+08:00 0 [Note] [MY-011825] [Xtrabackup] recognized server arguments: --server-id=3308 --datadir=/data/mysql/mysql3308/data --open_files_limit=65535 --log_bin=/data/mysql/mysql3308/data/mybinlog --innodb_buffer_pool_size=100M --innodb_data_file_path=ibdata1:12M:autoextend --innodb_flush_log_at_trx_commit=1 --innodb_log_buffer_size=32M --innodb_log_file_size=1G --innodb_log_files_in_group=3 --innodb_io_capacity=4000 --innodb_open_files=65535 --innodb_flush_method=O_DIRECT --innodb_adaptive_hash_index=0 --innodb_adaptive_hash_index=0 
2024-08-06T14:10:35.140688+08:00 0 [Note] [MY-011825] [Xtrabackup] recognized client arguments: --port=3308 --socket=/tmp/mysql3308.sock --copy-back=1 --target-dir=/data/backup/db3306_full/ 
xtrabackup version 8.0.35-31 based on MySQL server 8.0.35 Linux (x86_64) (revision id: 55ec21d7)
2024-08-06T14:10:35.140711+08:00 0 [Note] [MY-011825] [Xtrabackup] cd to /data/backup/db3306_full/
2024-08-06T14:10:35.141507+08:00 0 [Note] [MY-011825] [Xtrabackup] Copying undo_001 to /data/mysql/mysql3308/data/undo_001
2024-08-06T14:10:35.200687+08:00 0 [Note] [MY-011825] [Xtrabackup] Done: Copying undo_001 to /data/mysql/mysql3308/data/undo_001
2024-08-06T14:10:35.209907+08:00 0 [Note] [MY-011825] [Xtrabackup] Copying undo_002 to /data/mysql/mysql3308/data/undo_002
2024-08-06T14:10:35.243725+08:00 0 [Note] [MY-011825] [Xtrabackup] Done: Copying undo_002 to /data/mysql/mysql3308/data/undo_002
2024-08-06T14:10:35.260550+08:00 0 [Note] [MY-011825] [Xtrabackup] Copying ibdata1 to /data/mysql/mysql3308/data/ibdata1
......
2024-08-06T14:10:35.557160+08:00 1 [Note] [MY-011825] [Xtrabackup] Copying ./xtrabackup_info to /data/mysql/mysql3308/data/xtrabackup_info
2024-08-06T14:10:35.557220+08:00 1 [Note] [MY-011825] [Xtrabackup] Done: Copying ./xtrabackup_info to /data/mysql/mysql3308/data/xtrabackup_info
2024-08-06T14:10:35.557845+08:00 1 [Note] [MY-011825] [Xtrabackup] Creating directory ./#innodb_redo
2024-08-06T14:10:35.557876+08:00 1 [Note] [MY-011825] [Xtrabackup] Done: creating directory ./#innodb_redo
2024-08-06T14:10:35.557954+08:00 1 [Note] [MY-011825] [Xtrabackup] Copying ./ibtmp1 to /data/mysql/mysql3308/data/ibtmp1
2024-08-06T14:10:35.595855+08:00 1 [Note] [MY-011825] [Xtrabackup] Done: Copying ./ibtmp1 to /data/mysql/mysql3308/data/ibtmp1
2024-08-06T14:10:35.618690+08:00 0 [Note] [MY-011825] [Xtrabackup] completed OK!

启动

 /usr/local/mysql/bin/mysqld --defaults-file=/data/mysql/mysql3308/my3308.cnf &[root@postgre data]# /usr/local/mysql/bin/mysql -uroot -p -S /tmp/mysql3308.sock
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.37 MySQL Community Server - GPLCopyright (c) 2000, 2024, Oracle and/or its affiliates.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.mysql> show master status;
+-----------------+----------+--------------+------------------+------------------------------------------+
| File            | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set                        |
+-----------------+----------+--------------+------------------+------------------------------------------+
| mybinlog.000004 |      197 |              |                  | f25d3a39-53a2-11ef-9508-000c29a318a4:1-4 |
+-----------------+----------+--------------+------------------+------------------------------------------+
1 row in set (0.00 sec)

xtrabackup还原后,可以看到从库的GTID信息已经有了,而且是和主库一致的,那么此时我们就可以直接change

mysql> change master to master_host='10.1.11.30', master_port=3306, master_user='repl', master_password='repl',master_auto_position=1;
Query OK, 0 rows affected, 8 warnings (0.03 sec)
mysql> start slave;
Query OK, 0 rows affected, 1 warning (0.37 sec)mysql> show slave status\G
*************************** 1. row ***************************Slave_IO_State: Connecting to sourceMaster_Host: 10.1.11.30Master_User: replMaster_Port: 3306Connect_Retry: 60Master_Log_File: Read_Master_Log_Pos: 4Relay_Log_File: postgre-relay-bin.000001Relay_Log_Pos: 4Relay_Master_Log_File: Slave_IO_Running: ConnectingSlave_SQL_Running: YesReplicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 0Last_Error: Skip_Counter: 0Exec_Master_Log_Pos: 0Relay_Log_Space: 157Until_Condition: NoneUntil_Log_File: Until_Log_Pos: 0Master_SSL_Allowed: NoMaster_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: NoLast_IO_Errno: 2061Last_IO_Error: Error connecting to source 'repl@10.1.11.30:3306'. This was attempt 1/86400, with a delay of 60 seconds between attempts. Message: Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection.Last_SQL_Errno: 0Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 0Master_UUID: Master_Info_File: mysql.slave_master_infoSQL_Delay: 0SQL_Remaining_Delay: NULLSlave_SQL_Running_State: Replica has read all relay log; waiting for more updatesMaster_Retry_Count: 86400Master_Bind: Last_IO_Error_Timestamp: 240806 14:22:03Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: Executed_Gtid_Set: f25d3a39-53a2-11ef-9508-000c29a318a4:1-4Auto_Position: 1Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: Master_public_key_path: Get_master_public_key: 0Network_Namespace: 
1 row in set, 1 warning (0.35 sec)mysql> show slave status\G
*************************** 1. row ***************************
......Slave_IO_Running: ConnectingSlave_SQL_Running: Yes
.....Last_IO_Error: Error connecting to source 'repl@10.1.11.30:3306'. This was attempt 1/86400, with a delay of 60 seconds between attempts. Message: Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection.
......Retrieved_Gtid_Set: Executed_Gtid_Set: f25d3a39-53a2-11ef-9508-000c29a318a4:1-4
.....
1 row in set, 1 warning (0.07 sec)

直接start slave,会报错。这是MySQL 8.0新的密码机制决定的,我们手动登录一次即可或者change加参数GET_MASTER_PUBLIC_KEY=1或者改为原始的认证方式mysql_native_passwor ,三者选其一即可。
我们采用第二种:

mysql> stop slave;
Query OK, 0 rows affected, 1 warning (0.07 sec)mysql> change master to Get_master_public_key=1;
Query OK, 0 rows affected, 2 warnings (0.01 sec)mysql> start slave;
Query OK, 0 rows affected, 1 warning (0.12 sec)

恢复正常:

mysql> show slave status\G
*************************** 1. row ***************************Slave_IO_State: Waiting for source to send eventMaster_Host: 10.1.11.30Master_User: replMaster_Port: 3306Connect_Retry: 60Master_Log_File: mybinlog.000004Read_Master_Log_Pos: 737Relay_Log_File: postgre-relay-bin.000002Relay_Log_Pos: 911Relay_Master_Log_File: mybinlog.000004Slave_IO_Running: YesSlave_SQL_Running: Yes
.......Retrieved_Gtid_Set: f25d3a39-53a2-11ef-9508-000c29a318a4:5-6Executed_Gtid_Set: f25d3a39-53a2-11ef-9508-000c29a318a4:1-6Auto_Position: 1
......Get_master_public_key: 1

还有一点,在上面start slave之前,状态是这样的:
在这里插入图片描述
Executed_Gtid_Set:表示从库已经执行了的GTID,就跟前面一致,现在从库的GTID已经执行到4 seq#,,如果此时主库的GTID执行比4大,那么Retrieved_Gtid_Set就会显示新的值,比4大的,从库缺少的从4以来的记录。

参考:

MySQL主从复制之GTID模式介绍

GTID概述

MySQL5.6 在原有主从复制的基础上增加了一个新的复制方式,即基于GTID的复制方式,它由UUID和事务ID两个部分组成,具有如下特点。
GTID事务是全局唯一性的,并且一个事务对应一个GTID值。
一个GTID值在同一个MySQL实例上只会执行一次。

GTID相较与传统复制的优势

主从搭建更加简便,不用手动特地指定position位置。
复制集群内有一个统一的标识,识别、管理上更方便。
故障转移更容易,不用像传统复制那样需要找 log_file 和 log_Pos的位置。
通常情况下GTID是连续没有空洞的,更能保证数据的一致性,零丢失。
相对于ROW复制模式,数据安全性更高,切换更简单。
比传统的复制更加安全,一个GTID在一个MySQL实例上只会执行一次,避免重复执行导致数据混乱或者主从不一致。

GTID自身存在哪些限制

在一个复制组中,必须都要开启GTID。
MySQL5.6开启GTID需要重启。
不支持sql_slave_skip_counte操作,传统复制可以使用这个命令跳过事务。
不允许在一个SQL同时更新一个事务引擎和非事务引擎的表,如InnoDB和MyISAM。
对于create temporary table 和drop temporary table语句不支持。
不支持create table … select 语句复制。

GTID工作原理简单介绍

master节点在更新数据的时候,会在事务前产生GTID信息,一同记录到binlog日志中。
slave节点的io线程将binlog写入到本地relay log中。
然后SQL线程从relay log中读取GTID,设置gtid_next的值为该gtid,然后对比slave端的binlog是否有记录。
如果有记录的话,说明该GTID的事务已经运行,slave会忽略。
如果没有记录的话,slave就会执行该GTID对应的事务,并记录到binlog中。

如何开启GTID复制

除传统复制需要开启的binlog相关参数之外,GTID同步需额外开启如下参数设置,注意主从节点需要同步开启。
在这里插入图片描述

查看GTID相关参数
在这里插入图片描述

参数简要说明
在这里插入图片描述

GTID与传统模式建立复制时候语句的不同点

传统复制

change master to master_host=“127.0.0.1”,master_port=3310,MASTER_USER=‘sync’,MASTER_PASSWORD=‘GreatSQL’,MASTER_LOG_FILE=‘log-bin.000005’, MASTER_LOG_POS=4111;

GTID复制

change master to master_host=“127.0.0.1”,master_port=3310,MASTER_USER=‘sync’,MASTER_PASSWORD=‘GreatSQL’,MASTER_AUTO_POSITION=1
GTID同步在建立复制的时候,将传统复制由人为指定binlog的pos位点改为了MASTER_AUTO_POSITION=1自动获取binlog的pos位点。

GTID同步状态简单解析

除了传统的查看binlog和pos值之外,GTID模式可以更直观的查看某个事务执行的情况。

[root@GreatSQL][(none)]>show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.6.215
Master_User: sync
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: binlog.000001
Read_Master_Log_Pos: 2425
Relay_Log_File: mgr2-relay-bin.000002
Relay_Log_Pos: 2634
Relay_Master_Log_File: binlog.000001
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: 2425
Relay_Log_Space: 2842
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: 2153306
Master_UUID: 613743f5-8b1c-11ec-9922-00155dcff911
Master_Info_File: mysql.slave_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: 613743f5-8b1c-11ec-9922-00155dcff911:1-10
Executed_Gtid_Set: 613743f5-8b1c-11ec-9922-00155dcff911:1-10,
652ade08-8b1c-11ec-9f62-00155dcff90a:1-2
Auto_Position: 1
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
Master_public_key_path:
Get_master_public_key: 0
Network_Namespace:
1 row in set, 1 warning (0.01 sec)

ERROR:
No query specified
GTID相关键参数说明
在这里插入图片描述

整个过程如下:

groupadd mysql
useradd -g mysql -s /sbin/nologin -d /usr/local/mysql -MN mysql
cd /opt
unxz mysql-8.0.37-linux-glibc2.17-x86_64.tar.xz 
tar -xvf mysql-8.0.37-linux-glibc2.17-x86_64.tar 
cd /usr/local
ln -s /opt/mysql-8.0.37-linux-glibc2.17-x86_64 mysql
chown -R mysql:mysql /usr/local/mysql/
mkdir -p /data/mysql/mysql3306/{data,logs,tmp}
mv /opt/my.cnf /data/mysql/mysql3306/my3306.cnf
chown -R mysql:mysql /usr/local/mysql/
chown -R mysql:mysql /data/mysql/mysql3306//usr/local/mysql/bin/mysqld --defaults-file=/data/mysql/mysql3306/my3306.cnf --initialize
/usr/local/mysql/bin/mysqld --defaults-file=/data/mysql/mysql3306/my3306.cnf &/usr/local/mysql/bin/mysql -uroot -p -S /tmp/mysql3306.sock
alter user user() identified by 'mysql';
show databases;
create database test;
use test;
create table test(id int,name char);
insert into test values(1,'a');
create user repl@'%' identified by 'repl';
grant replication slave on *.* to repl@'%';cd /data/
mkdir -p backup/db3306_full/
xtrabackup --defaults-file=/data/mysql/mysql3306/my3306.cnf -S /tmp/mysql3306.sock -uroot -p --backup --target-dir=/data/backup/db3306_full
xtrabackup --prepare --target-dir=/data/backup/db3306_full
mkdir -p /data/mysql/mysql3308/{data,logs,tmp}
cp /data/mysql/mysql3306/my3306.cnf /data/mysql/mysql3308/my3308.cnf
sed -i 's/3306/3308/g' /data/mysql/mysql3308/my3308.cnf
xtrabackup --defaults-file=/data/mysql/mysql3308/my3308.cnf --copy-back --target-dir=/data/backup/db3306_full/
chown -R mysql:mysql /data/mysql/mysql3308//usr/local/mysql/bin/mysqld --defaults-file=/data/mysql/mysql3308/my3308.cnf &
/usr/local/mysql/bin/mysql -uroot -p -S /tmp/mysql3308.sock
/usr/local/mysql/bin/mysql -h 10.1.11.30 -P3306 -urepl -prepl
change master to master_host='10.1.11.30', master_port=3306, master_user='repl', master_password='repl',master_auto_position=1;
start slave;
show slave status\G或者不用登录一次,直接加参数解决:
change master to master_host='10.1.11.30', master_port=3306, master_user='repl', master_password='repl',master_auto_position=1 GET_MASTER_PUBLIC_KEY=1;

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/398034.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Linux系统编程 day09 线程同步

Linux系统编程 day09 线程同步 1.互斥锁2.死锁3.读写锁4.条件变量&#xff08;生产者消费者模型&#xff09;5.信号量 1.互斥锁 互斥锁是一种同步机制&#xff0c;用于控制多个线程对共享资源的访问&#xff0c;确保在同一时间只有一个线程可以访问特定的资源或执行特定的操作…

机器学习第一课

1.背景 有监督学习&#xff1a;有标签&#xff08;连续变量&#xff08;回归问题&#xff1a;时间序列等&#xff09;、分类变量&#xff08;分类&#xff09;&#xff09; 无监督学习&#xff1a;没有标签&#xff08;聚类、关联&#xff08;相关性分析&#xff1a;哪些相关…

代码随想录算法训练营Day35 | 01背包问题 | 416. 分割等和子集

今日任务 01背包问题 题目链接&#xff1a; https://kamacoder.com/problempage.php?pid1046题目描述&#xff1a; Code #include <iostream> #include <vector> #include <functional> #include <algorithm>using namespace std;int main(void)…

工作随记:我在OL8.8部署oracle rac遇到的问题

文章目录 一、安装篇问题1&#xff1a;[INS-08101] Unexpected error while executing the action at state:supportedosCheck问题1解决办法&#xff1a;问题2&#xff1a;[INS-06003] Failed to setup passwordless SSH connectivity with thefollowing nodeis): [xxxx1, xxxx…

go语言后端开发学习(四) —— 在go项目中使用Zap日志库

一.前言 在之前的文章中我们已经介绍过如何使用logrus包来作为我们在gin框架中使用的日志中间件&#xff0c;而今天我们要介绍的就是我们如何在go项目中如何集成Zap来作为日志中间件 二.Zap的安装与快速使用 和安装其他第三方包没什么区别&#xff0c;我们下载Zap包只需要执…

pod详解 list-watch机制 预选优选策略 如何指定节点调度pod

K8S是通过 list-watch 机制实现每个组件的协同工作 controller-manager、scheduler、kubelet 通过 list-watch 机制监听 apiserver 发出的事件&#xff0c;apiserver 也会监听 etcd 发出的事件 scheduler的调度策略&#xff1a; 预选策略&#xff08;Predicates&#xff09;…

Pytorch_cuda版本的在线安装命令

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 运行效果如下&#xff1a; 这个方法是直接从pytorch官网进行在线下载和安装。 cu121&#xff0c;表示当前您安装的cuda版本是12.1

【Redis】持久化—RDB和AOF机制

目录 什么是持久化&#xff1f; RDB&#xff08;定期备份&#xff09; 触发机制 bgsave命令的运作流程 RDB文件的处理 RDB文件 RDB的优缺点 AOF&#xff08;实时备份&#xff09; AOF工作流程 AOF 缓冲区同步⽂件策略 AOF重写机制 AOF重写流程 Redis根据持久化文件…

2015款到18款奔驰GLC升级为2021款的HU6主机后,实现了触摸屏人机交互和Carplay功能

奔驰GLC是北京奔驰生产的一款中型SUV。有车主将2015款奔驰GLC升级为2021款的HU6主机后&#xff0c;实现了触摸屏人机交互和Carplay功能。该车主分享了使用体验&#xff1a; • Carplay功能&#xff1a;可以直接在车机大屏幕上显示导航、音乐和电话信息&#xff0c;让用户在开车…

联想SR650更换风扇后提示传感器异常“传感器Phy Presence Set已从正常状态转换至非紧急状态”

服务器型号&#xff1a;联想ThinkSystem SR650 故障现象&#xff1a;一台联想 ThinkSystem SR650服务器告警&#xff0c;面板和平台同时报风扇故障 告警信息如下图&#xff1a;&#xff08;面板和平台同时告警&#xff09; 接入bmc后查看发现是6号风扇告警 硬件这里已经无法识…

会C++了,想开始接触C#怎么办?|.Net 架构|从C++到C#的入门教学

前言 高质量博客汇总https://blog.csdn.net/yu_cblog/category_12379430.html成熟常用的开发工具和框架https://blog.csdn.net/yu_cblog/category_12737979.htmlDocker从认识到实践再到底层原理https://blog.csdn.net/yu_cblog/category_12424689.html操作系统和计算机网络从入…

[C++] 深入理解面向对象编程特性 : 继承

文章目录 继承的概念与定义继承的定义定义格式不同继承方式与继承的基类中访问限定符间的影响C中的继承和访问控制总结父类的private成员在子类中的访问限制protected成员的使用场景成员访问方式总结继承方式的默认值实际应用中的继承方式 示例代码 OOP中类之间的关系“is a” …

PLSQL导入导出ORACLE数据提示失败问题修改PLSQL配置

oracle中plsql导入提示无法导入问题 1.首先看下是否环境变量已经配置(具体配置看下面环境变量配置) 2.plsql数据导入中tools-->Preferences中配置如下框中的内容 3.设置 tnsnames.ora文件中看下是否设置有问题 4.PLSQL乱码问题 NLS_LANG SIMPLIFIED CHINESE_CHINA.ZHS16…

性能测试工具之JMeter

JMeter Apache JMeter应用程序是开源软件,是一个100%纯Java应用程序,旨在负载测试功能行为和衡量性能。它最初是为测试Web应用程序而设计的,但后来扩展到其他测试功能。 JMeter是一个免费、开源、跨平台的性能测试工具,于20世纪90年代后期面世。这是一个成熟、健全且具有…

湖南(市场调查)源点咨询 构建多元样本是如何改善调研结果的?

湖南&#xff08;市场调研&#xff09;源点咨询认为&#xff0c;大多数市场研究从业者更倾向于从单一数据源获取调研样本&#xff0c;然而在很多情况下&#xff0c;仅从单个数据源很难获得真正具有代表性的样本。 使用多元样本源有两大好处&#xff1a; ①能够捕获不愿加入样…

2024110读书笔记|《飞花令·月》——长安一片月,万户捣衣声,独出前门望野田,月明荞麦花如雪

2024110读书笔记|《飞花令月》——长安一片月&#xff0c;万户捣衣声&#xff0c;独出前门望野田&#xff0c;月明荞麦花如雪 《飞花令月》素心落雪 编著&#xff0c;飞花令得名于唐代诗人韩翃《寒食》中的名句“春城无处不飞花”&#xff0c;类似于行酒令&#xff0c;是文人们…

Java数组篇[5]:数组的排序和查找

哈喽&#xff0c;各位小伙伴们&#xff0c;你们好呀&#xff0c;我是喵手。运营社区&#xff1a;C站/掘金/腾讯云/阿里云/华为云/51CTO&#xff1b;欢迎大家常来逛逛 今天我要给大家分享一些自己日常学习到的一些知识点&#xff0c;并以文字的形式跟大家一起交流&#xff0c;互…

1960-2020中国1km分辨率年均气温数据

数据简介 中国1km分辨率年均气温数据是在中国大陆2400多个站点的气温年统计结果的基础上&#xff0c;融合了NOAA Gsod中包括港澳台在内亚洲地区1300个站点的数据&#xff0c;使用Ansuplin插值软件生成的1960-2020年0.01&#xff08;约1km&#xff09;的网格数据。 Ansuplin基…

shell外壳与Linux权限

&#x1f308;个人主页&#xff1a;Yui_ &#x1f308;Linux专栏&#xff1a;Linux &#x1f308;C语言笔记专栏&#xff1a;C语言笔记 &#x1f308;数据结构专栏&#xff1a;数据结构 文章目录 1.shell命令以及运行原理2. Linux权限的概念3.Linux权限管理3.1 文件访问者的分类…

vue3前端开发-小兔鲜项目-添加购物车操作第一步

首先&#xff0c;呢&#xff0c;告诉大家一个坏消息&#xff0c;官方媒体的案例代码已经被他们删除了。如图所示。 也就是说&#xff0c;大家已经看不到官方的代码文件了。 那么既然如此&#xff0c;我们自己写的这个博客记录日志&#xff0c;就显得尤为重要了。继续今天的内容…