当前位置: 首页 > news >正文

MySQL InnoDB Replication部署方案与实践

1. 概述

MySQL Innodb ReplicaSet 是 MySQL 团队在 2020 年推出的一款产品,用来帮助用户快速部署和管理主从复制,在数据库层仍然使用的是主从复制技术。

ReplicaSet 主要包含三个组件:MySQL Router、MySQL Server 以及 MySQL Shell 高级客户端。

MySQL Shell 负责管理 ReplicaSet 包括部署、切换、节点加入等,都可以通过内置 AdminAPI 自动化完成。

MySQL Router 是一款轻量级中间件,可在应用程序和 ReplicaSet 之间提供透明路由和读写分离功能。

2. 适用场景

InnoDB ReplicaSet至少由两台MySQL服务器实例组成,提供MySQL主从复制功能。InnoDB ReplicaSet基于异步的主从复制实现,因此适用于用户对高可用性要求不高的环境。可以通过MySQL Shell快速搭建及管理主从复制,避免了搭建主从复制时大量的手动操作。

InnoDB ReplicaSet的不足之处有:

  • 不支持自动故障转移。主库不可用时,需要通过AdminAPI手动发起故障转移。

  • 发生计划外的服务不可用时,可能会丢失部分数据。由于主备之间是异步复制,主库发生故障时,未提交的事务会丢失。

  • 发生计划外的服务不可用时,可能会产生数据不一致。例如由于网络原因导致主库连不上,将备库提升为主库后,可能会同时存在两个主库,即发生“脑裂”。

  • 不支持多主模式,即同一时刻只有一个主库可写。

  • 读扩展受限,不能像组复制那样对流量进行控制。

  • 所有的备库都从同一个主库复制数据。在有大量的小更新时,可能会对主库造成影响。

  • 仅支持MySQL 8.0及其以后的版本。

  • 仅支持基于GTID的日志复制。

  • 仅支持基于行的日志复制(Row-Based Replication, RBR),不支持基于SQL语句的复制(Statement-Based Replication, SBR)。

  • 不支持复制过滤。

  • RS为一个主库加多个从库的架构。需要通过MySQL Router监视RS中的实例,因此从库的数量不能无限制增加。

  • 必须通过MySQL Shell配置和管理,包括复制用户的创建。

3. 安装部署

IProlehostname版本OS
192.168.10.31Mastermysql-rs-1MySQL 8.2Centos_7.9_x86_x64
192.168.10.32Secondarymysql-rs-2MySQL 8.2Centos_7.9_x86_x64

3.1. 安装MySQL servers

分别在两个MySQL服务器下载MySQL Server安装包,并进行安装。

# 配置主机名
echo "192.168.10.31   mysql-rs-1" >> /etc/hosts
echo "192.168.10.32   mysql-rs-2" >> /etc/hosts
​
# 192.168.10.31执行
hostnamectl set-hostname mysql-rs-1
bash
# 192.168.10.32执行
hostnamectl set-hostname mysql-rs-2
bash
# 下载rpm安装包
wget https://cdn.mysql.com//Downloads/MySQL-8.2/mysql-8.2.0-1.el7.x86_64.rpm-bundle.tar
​
# 解压
tar -xvf mysql-8.2.0-1.el7.x86_64.rpm-bundle.tar
​
# 卸载mariadb
rpm -e mariadb-libs-5.5.68-1.el7.x86_64 --nodeps
​
# 安装MySQL
yum localinstall -y *.rpm

分别配置root密码:

[root@mysql-rs-2 server]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.2.0
​
Copyright (c) 2000, 2023, 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> 
mysql> 
mysql> alter user root@'localhost' identified by 'Abcd@1234';
Query OK, 0 rows affected (0.00 sec)
​
mysql> create user root@'%' identified by 'Abcd@1234';
Query OK, 0 rows affected (0.01 sec)

3.2. 安装mysqlsh

# 下载mysqlshell
wget https://cdn.mysql.com//Downloads/MySQL-Shell/mysql-shell-8.2.0-1.el7.x86_64.rpm
# 安装mysqlshell
rpm -ivh mysql-shell-8.2.0-1.el7.x86_64.rpm

验证mysql shell链接数据库

[root@mysql-rs-1 software]# mysqlsh --mysql -u root -h localhost -C
Please provide the password for 'root@localhost': ************
Save password for 'root@localhost'? [Y]es/[N]o/Ne[v]er (default No): 
Error during auto-completion cache update: You must reset your password using ALTER USER statement before executing this statement.
MySQL Shell 8.2.0
​
Copyright (c) 2016, 2023, 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 '\?' for help; '\quit' to exit.
Creating a Classic session to 'root@localhost?compression=REQUIRED'
Your MySQL connection id is 8
No default schema selected; type \use <schema> to set one.MySQL  localhost  JS > 

3.3. 配置实例

在其中一个主机上启动mysqlsh连接

[root@mysql-rs-1 software]# mysqlsh root@mysql-rs-1:3306
MySQL Shell 8.2.0
​
Copyright (c) 2016, 2023, 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 '\?' for help; '\quit' to exit.
Creating a session to 'root@mysql-rs-1:3306'
Fetching schema names for auto-completion... Press ^C to stop.
Your MySQL connection id is 21
Server version: 8.2.0 MySQL Community Server - GPL
No default schema selected; type \use <schema> to set one.

分别给root用户授权:

GRANT CLONE_ADMIN, CONNECTION_ADMIN, CREATE USER, EXECUTE, FILE, GROUP_REPLICATION_ADMIN, PERSIST_RO_VARIABLES_ADMIN, PROCESS, RELOAD, REPLICATION CLIENT, REPLICATION SLAVE, REPLICATION_APPLIER, REPLICATION_SLAVE_ADMIN, ROLE_ADMIN, SELECT, SHUTDOWN, SYSTEM_VARIABLES_ADMIN ON *.* TO 'root'@'%' WITH GRANT OPTION;
GRANT DELETE, INSERT, UPDATE ON mysql.* TO 'root'@'%' WITH GRANT OPTION;
GRANT ALTER, ALTER ROUTINE, CREATE, CREATE ROUTINE, CREATE TEMPORARY TABLES, CREATE VIEW, DELETE, DROP, EVENT, EXECUTE, INDEX, INSERT, LOCK TABLES, REFERENCES, SHOW VIEW, TRIGGER, UPDATE ON mysql_innodb_cluster_metadata.* TO 'root'@'%' WITH GRANT OPTION;
GRANT ALTER, ALTER ROUTINE, CREATE, CREATE ROUTINE, CREATE TEMPORARY TABLES, CREATE VIEW, DELETE, DROP, EVENT, EXECUTE, INDEX, INSERT, LOCK TABLES, REFERENCES, SHOW VIEW, TRIGGER, UPDATE ON mysql_innodb_cluster_metadata_bkp.* TO 'root'@'%' WITH GRANT OPTION;
GRANT ALTER, ALTER ROUTINE, CREATE, CREATE ROUTINE, CREATE TEMPORARY TABLES, CREATE VIEW, DELETE, DROP, EVENT, EXECUTE, INDEX, INSERT, LOCK TABLES, REFERENCES, SHOW VIEW, TRIGGER, UPDATE ON mysql_innodb_cluster_metadata_previous.* TO 'root'@'%' WITH GRANT OPTION;

在MySQL Shell中执行:

配置mysql-rs-1:

 MySQL  mysql-rs-1:3306 ssl  JS > dba.configureReplicaSetInstance('root@mysql-rs-1:3306', {clusterAdmin: "rs_admin"})
Configuring local MySQL instance listening at port 3306 for use in an InnoDB ReplicaSet...
​
This instance reports its own address as mysql-rs-1:3306
Clients and other cluster members will communicate with it through this address by default. If this is not correct, the report_host MySQL system variable should be changed.
Assuming full account name 'rs_admin'@'%' for rs_admin
Password for new account: *********
Confirm password: *********
​
applierWorkerThreads will be set to the default value of 4.
​
NOTE: Some configuration options need to be fixed:
+----------------------------------------+---------------+----------------+--------------------------------------------------+
| Variable                               | Current Value | Required Value | Note                                             |
+----------------------------------------+---------------+----------------+--------------------------------------------------+
| binlog_transaction_dependency_tracking | COMMIT_ORDER  | WRITESET       | Update the server variable                       |
| enforce_gtid_consistency               | OFF           | ON             | Update read-only variable and restart the server |
| gtid_mode                              | OFF           | ON             | Update read-only variable and restart the server |
| server_id                              | 1             | <unique ID>    | Update read-only variable and restart the server |
+----------------------------------------+---------------+----------------+--------------------------------------------------+
​
Some variables need to be changed, but cannot be done dynamically on the server.
Do you want to perform the required configuration changes? [y/n]: y
Do you want to restart the instance after configuring it? [y/n]: y
​
Creating user rs_admin@%.
Account rs_admin@% was successfully created.
​
Configuring instance...
​
WARNING: '@@binlog_transaction_dependency_tracking' is deprecated and will be removed in a future release. (Code 1287).
The instance 'mysql-rs-1:3306' was configured to be used in an InnoDB ReplicaSet.
Restarting MySQL...
NOTE: MySQL server at mysql-rs-1:3306 was restarted.

配置mysql-rs-2:

 MySQL  mysql-rs-1:3306 ssl  JS > dba.configureReplicaSetInstance('root@mysql-rs-2:3306', {clusterAdmin: "rs_admin"})
Please provide the password for 'root@mysql-rs-2:3306': *********
Save password for 'root@mysql-rs-2:3306'? [Y]es/[N]o/Ne[v]er (default No): Y
Configuring MySQL instance at mysql-rs-2:3306 for use in an InnoDB ReplicaSet...
​
This instance reports its own address as mysql-rs-2:3306
Clients and other cluster members will communicate with it through this address by default. If this is not correct, the report_host MySQL system variable should be changed.
Assuming full account name 'rs_admin'@'%' for rs_admin
Password for new account: *********
Confirm password: *********
​
applierWorkerThreads will be set to the default value of 4.
​
NOTE: Some configuration options need to be fixed:
+----------------------------------------+---------------+----------------+--------------------------------------------------+
| Variable                               | Current Value | Required Value | Note                                             |
+----------------------------------------+---------------+----------------+--------------------------------------------------+
| binlog_transaction_dependency_tracking | COMMIT_ORDER  | WRITESET       | Update the server variable                       |
| enforce_gtid_consistency               | OFF           | ON             | Update read-only variable and restart the server |
| gtid_mode                              | OFF           | ON             | Update read-only variable and restart the server |
| server_id                              | 1             | <unique ID>    | Update read-only variable and restart the server |
+----------------------------------------+---------------+----------------+--------------------------------------------------+
​
Some variables need to be changed, but cannot be done dynamically on the server.
Do you want to perform the required configuration changes? [y/n]: y
Do you want to restart the instance after configuring it? [y/n]: y
​
Creating user rs_admin@%.
Account rs_admin@% was successfully created.
​
Configuring instance...
​
WARNING: '@@binlog_transaction_dependency_tracking' is deprecated and will be removed in a future release. (Code 1287).
The instance 'mysql-rs-2:3306' was configured to be used in an InnoDB ReplicaSet.
Restarting MySQL...
NOTE: MySQL server at mysql-rs-2:3306 was restarted.

3.4. 创建ReplicationSet

创建ReplicationSet,默认会将当前进入的实例为主库实例:

 MySQL  mysql-rs-1:3306 ssl  JS > dba.createReplicaSet('ReplicaSet')
A new replicaset with instance 'mysql-rs-1:3306' will be created.
​
* Checking MySQL instance at mysql-rs-1:3306
​
This instance reports its own address as mysql-rs-1:3306
mysql-rs-1:3306: Instance configuration is suitable.
​
* Checking connectivity and SSL configuration...
* Updating metadata...
​
ReplicaSet object successfully created for mysql-rs-1:3306.
Use rs.addInstance() to add more asynchronously replicated instances to this replicaset and rs.status() to check its status.
​
<ReplicaSet:ReplicaSet> 

3.5. 将另一个实例加入到创建的 ReplicaSet

 MySQL  mysql-rs-1:3306 ssl  JS > var rs = dba.getReplicaSet()You are connected to a member of replicaset 'ReplicaSet'.MySQL  mysql-rs-1:3306 ssl  JS > rs.addInstance('mysql-rs-2:3306')
Adding instance to the replicaset...
​
* Performing validation checks
​
This instance reports its own address as mysql-rs-2:3306
mysql-rs-2:3306: Instance configuration is suitable.
​
* Checking async replication topology...
​
* Checking connectivity and SSL configuration...
​
* Checking transaction state of the instance...
​
NOTE: The target instance 'mysql-rs-2:3306' has not been pre-provisioned (GTID set is empty). The Shell is unable to decide whether replication can completely recover its state.
The safest and most convenient way to provision a new instance is through automatic clone provisioning, which will completely overwrite the state of 'mysql-rs-2:3306' with a physical snapshot from an existing replicaset member. To use this method by default, set the 'recoveryMethod' option to 'clone'.
​
WARNING: It should be safe to rely on replication to incrementally recover the state of the new instance if you are sure all updates ever executed in the replicaset were done with GTIDs enabled, there are no purged transactions and the new instance contains the same GTID set as the replicaset or a subset of it. To use this method by default, set the 'recoveryMethod' option to 'incremental'.
​
​
Please select a recovery method [C]lone/[I]ncremental recovery/[A]bort (default Clone): 
* Updating topology
Monitoring Clone based state recovery of the new member. Press ^C to abort the operation.
Clone based state recovery is now in progress.
​
NOTE: A server restart is expected to happen as part of the clone process. If the
server does not support the RESTART command or does not come back after a
while, you may need to manually start it back.
​
* Waiting for clone to finish...
NOTE: mysql-rs-2:3306 is being cloned from mysql-rs-1:3306
** Stage DROP DATA: Completed
** Clone Transfer  FILE COPY  ############################################################  100%  CompletedPAGE COPY  ############################################################  100%  CompletedREDO COPY  ############################################################  100%  Completed
* Clone process has finished: 76.80 MB transferred in about 1 second (~76.80 MB/s)
​
** Changing replication source of mysql-rs-2:3306 to mysql-rs-1:3306
** Waiting for new instance to synchronize with PRIMARY...
** Transactions replicated  ############################################################  100% 
​
The instance 'mysql-rs-2:3306' was added to the replicaset and is replicating from mysql-rs-1:3306.
​
* Waiting for instance 'mysql-rs-2:3306' to synchronize the Metadata updates with the PRIMARY...
** Transactions replicated  ############################################################  100% 

3.6. 查看副本集状态

 MySQL  mysql-rs-1:3306 ssl  JS > var rs = dba.getReplicaSet()
You are connected to a member of replicaset 'ReplicaSet'.MySQL  mysql-rs-1:3306 ssl  JS > rs.status()
{"replicaSet": {"name": "ReplicaSet", "primary": "mysql-rs-1:3306", "status": "AVAILABLE", "statusText": "All instances available.", "topology": {"mysql-rs-1:3306": {"address": "mysql-rs-1:3306", "instanceRole": "PRIMARY", "mode": "R/W", "status": "ONLINE"}, "mysql-rs-2:3306": {"address": "mysql-rs-2:3306", "instanceRole": "SECONDARY", "mode": "R/O", "replication": {"applierStatus": "APPLIED_ALL", "applierThreadState": "Waiting for an event from Coordinator", "applierWorkerThreads": 4, "receiverStatus": "ON", "receiverThreadState": "Waiting for source to send event", "replicationLag": null, "replicationSsl": "ECDHE-RSA-AES128-GCM-SHA256 TLSv1.2", "replicationSslMode": "REQUIRED"}, "status": "ONLINE"}}, "type": "ASYNC"}
}

3.7. 配置MySQL Router

# 下载MySQL Router
wget https://cdn.mysql.com//Downloads/MySQL-Router/mysql-router-community-8.2.0-1.el7.x86_64.rpm
# 安装
rpm -ivh mysql-router-community-8.2.0-1.el7.x86_64.rpmMySQL  mysql-rs-1:3306 ssl  JS > var rs = dba.getReplicaSet()
You are connected to a member of replicaset 'ReplicaSet'.MySQL  mysql-rs-1:3306 ssl  JS > rs.setupRouterAccount('rs_router1')
​
Missing the password for new account rs_router1@%. Please provide one.
Password for new account: *********
Confirm password: *********
​
​
Creating user rs_router1@%.
Account rs_router1@% was successfully created.

3.8. 引导启动MySQL Router

[root@mysql-rs-1 software]# mysqlrouter --bootstrap root@mysql-rs-1:3306 --user mysqlrouter
Please enter MySQL password for root: 
# Bootstrapping system MySQL Router 8.2.0 (MySQL Community - GPL) instance...
​
- Creating account(s) (only those that are needed, if any)
- Verifying account (using it to run SQL queries that would be run by Router)
- Storing account in keyring
- Adjusting permissions of generated files
- Creating configuration /etc/mysqlrouter/mysqlrouter.conf
​
Existing configuration backed up to '/etc/mysqlrouter/mysqlrouter.conf.bak'
​
# MySQL Router configured for the InnoDB ReplicaSet 'ReplicaSet'
​
After this MySQL Router has been started with the generated configuration
​$ /etc/init.d/mysqlrouter restart
or$ systemctl start mysqlrouter
or$ mysqlrouter -c /etc/mysqlrouter/mysqlrouter.conf
​
InnoDB ReplicaSet 'ReplicaSet' can be reached by connecting to:
​
## MySQL Classic protocol
​
- Read/Write Connections: localhost:6446
- Read/Only Connections:  localhost:6447
- Read/Write Split Connections: localhost:6450
​
## MySQL X protocol
​
- Read/Write Connections: localhost:6448
- Read/Only Connections:  localhost:6449

3.9. 读写分离验证

检查ReplicaSet,可以看到主节点(读写)为mysql-rs-1:3306,从节点(只读)为mysql-rs-2:3306

 MySQL  mysql-rs-1:3306 ssl  JS > rs.status()
{"replicaSet": {"name": "ReplicaSet", "primary": "mysql-rs-1:3306", "status": "AVAILABLE", "statusText": "All instances available.", "topology": {"mysql-rs-1:3306": {"address": "mysql-rs-1:3306", "instanceRole": "PRIMARY", "mode": "R/W", "status": "ONLINE"}, "mysql-rs-2:3306": {"address": "mysql-rs-2:3306", "instanceRole": "SECONDARY", "mode": "R/O", "replication": {"applierStatus": "APPLIED_ALL", "applierThreadState": "Waiting for an event from Coordinator", "applierWorkerThreads": 4, "receiverStatus": "ON", "receiverThreadState": "Waiting for source to send event", "replicationLag": null, "replicationSsl": "ECDHE-RSA-AES128-GCM-SHA256 TLSv1.2", "replicationSslMode": "REQUIRED"}, "status": "ONLINE"}}, "type": "ASYNC"}
}

检查mysqlrouter,可以看到MySQL Router读写端口为6450

 MySQL  mysql-rs-1:3306 ssl  JS > rs.listRouters()
{"replicaSetName": "ReplicaSet", "routers": {"mysql-rs-1::system": {"hostname": "mysql-rs-1", "lastCheckIn": "2023-11-14 11:40:21", "roPort": "6447", "roXPort": "6449", "rwPort": "6446", "rwSplitPort": "6450", "rwXPort": "6448", "version": "8.2.0"}}
}

下面通过MySQL Router的读写端口6450连接mysql数据库:

[root@mysql-rs-1 ~]# mysqlsh mysql://root@mysql-rs-1:6450 --sql
MySQL Shell 8.2.0
​
Copyright (c) 2016, 2023, 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 '\?' for help; '\quit' to exit.
Creating a Classic session to 'root@mysql-rs-1:6450'
Fetching global names for auto-completion... Press ^C to stop.
Your MySQL connection id is 0
Server version: 8.2.0 MySQL Community Server - GPL
No default schema selected; type \use <schema> to set one.MySQL  mysql-rs-1:6450 ssl  SQL > 

查询数据,发现当前节点为从节点:

 MySQL  mysql-rs-1:6450 ssl  SQL > select @@hostname, @@port;
+------------+--------+
| @@hostname | @@port |
+------------+--------+
| mysql-rs-2 |   3306 |
+------------+--------+
1 row in set (0.0035 sec)
Statement ID: 13700

开启事务,会自动切换到主节点:

 MySQL  mysql-rs-1:6450 ssl  SQL > start transaction;
Query OK, 0 rows affected (0.0031 sec)
Statement ID: 20477MySQL  mysql-rs-1:6450 ssl  ★  SQL > select @@hostname, @@port;
+------------+--------+
| @@hostname | @@port |
+------------+--------+
| mysql-rs-1 |   3306 |
+------------+--------+
1 row in set (0.0007 sec)
Statement ID: 20563

提交或者回滚事务后,自动切换到从节点:

 MySQL  mysql-rs-1:6450 ssl  ★  SQL > rollback;
Query OK, 0 rows affected (0.0006 sec)
Statement ID: 21909MySQL  mysql-rs-1:6450 ssl  SQL > select @@hostname, @@port;
+------------+--------+
| @@hostname | @@port |
+------------+--------+
| mysql-rs-2 |   3306 |
+------------+--------+
1 row in set (0.0020 sec)
Statement ID: 15489

只读事务中,也会切换到从节点:

 MySQL  mysql-rs-1:6450 ssl  SQL > start transaction read only;
Query OK, 0 rows affected (0.0029 sec)
Statement ID: 16970MySQL  mysql-rs-1:6450 ssl  ☆  SQL > select @@hostname, @@port;
+------------+--------+
| @@hostname | @@port |
+------------+--------+
| mysql-rs-2 |   3306 |
+------------+--------+
1 row in set (0.0010 sec)
Statement ID: 16996

用户还可以在会话中使用ROUTER SET access_mode=命令来定义应用要连接的实例类型:

 MySQL  mysql-rs-1:6450 ssl  SQL > router set access_mode='read_write';
Query OK, 0 rows affected (0.0004 sec)MySQL  mysql-rs-1:6450 ssl  -  SQL > select @@hostname, @@port;
+------------+--------+
| @@hostname | @@port |
+------------+--------+
| mysql-rs-1 |   3306 |
+------------+--------+
1 row in set (0.0017 sec)
Statement ID: 25535MySQL  mysql-rs-1:6450 ssl  SQL > router set access_mode='read_only';
Query OK, 0 rows affected (0.0006 sec)MySQL  mysql-rs-1:6450 ssl  -  SQL > select @@hostname, @@port;
+------------+--------+
| @@hostname | @@port |
+------------+--------+
| mysql-rs-2 |   3306 |
+------------+--------+
1 row in set (0.0043 sec)
Statement ID: 18508

4. 总结

总之,MySQL Router 8.2支持读写分离。这是一项有价值的功能,可以优化数据库性能和可扩展性,而无需在应用程序中进行任何更改。这种配置使您能够将所有读流量引导到只读实例,将所有写流量引导到读写实例。这不仅增强了用户的整体体验,还简化了数据库管理和部署。

读写实例是主实例或源实例。只读实例是副本(InnoDB集群的非主实例、ReplicaSet的非主实例或复制集群中的非主实例)。

相关文章:

MySQL InnoDB Replication部署方案与实践

1. 概述 MySQL Innodb ReplicaSet 是 MySQL 团队在 2020 年推出的一款产品&#xff0c;用来帮助用户快速部署和管理主从复制&#xff0c;在数据库层仍然使用的是主从复制技术。 ReplicaSet 主要包含三个组件&#xff1a;MySQL Router、MySQL Server 以及 MySQL Shell 高级客户…...

进程的同步和异步、进程互斥

一、进程同步和异步 同步&#xff08;Synchronous&#xff09;&#xff1a; 同步指的是程序按照顺序执行&#xff0c;一个操作完成后才能进行下一个操作。在多进程或多线程的环境中&#xff0c;同步意味着一个进程&#xff08;或线程&#xff09;在执行某个任务时&#xff0c;…...

搞定课件录制,新手必备指南!

“有人知道课件怎么录制吗&#xff1f;学校要求我们师范专业的学生出去实习&#xff0c;现在需要录制一个课件视频&#xff0c;以便在课堂上播放&#xff0c;可是我不会录制教学视频&#xff0c;真的很头疼&#xff0c;有人能帮帮我吗。” 随着在线教育的崛起&#xff0c;课件…...

DevOps搭建(九)-Jenkins实现基础CI、CD详细操作

1、创建可运行SpringBoot项目 1.1、创建一个新工程 在idea里创建一个项目,这里叫devops-test,如下图: String Boot版本要选择2.x的,依赖直选中Spring Web选项即可: 修改pom.xml文件,在build标签中增加如下内容,目的是简化jar包名称。 <finalName>devops-test&l…...

十指波课堂:让学习编程不再是难事

十指波课堂是一家致力于发展线上私教平台的教育机构&#xff0c;主要的科目是计算机编程相关语言。由于学习编程的过程较为困难&#xff0c;学习者没有具体的学习方向&#xff0c;将要达到的就业水平不明&#xff0c;总会因为一些小问题困扰几个小时&#xff0c;这样会严重的影…...

IDEA卡顿,进行性能优化设置(亲测有效)——情况二

问题背景与现象 IDEA今天突然显示到期&#xff0c;于是从同事那边搞到一个很好用的破解方式&#xff0c;说实话&#xff0c;非常方便&#xff08;后续在安前码后中分享&#xff09; 破解之后呢&#xff0c;香了一阵子&#xff0c;但是突然显示开始卡顿&#xff0c;界面几乎是…...

利用Python和OpenCV实现将图像识别为Excel表格的便捷方法

当今社会&#xff0c;图像识别技术的发展为我们提供了许多便利&#xff0c;比如将图像中的文本信息转化为可编辑的电子表格。在本文中&#xff0c;我们将介绍如何利用Python结合OpenCV和pytesseract库&#xff0c;来实现将图像识别为Excel表格的过程。 首先&#xff0c;我们需…...

mysql:查看一个表的索引信息

可以使用命令SHOW INDEX FROM table_name;查看一个表的索引信息&#xff0c;例如&#xff1a;...

12月11日作业

完善对话框&#xff0c;点击登录对话框&#xff0c;如果账号和密码匹配&#xff0c;则弹出信息对话框&#xff0c;给出提示”登录成功“&#xff0c;提供一个Ok按钮&#xff0c;用户点击Ok后&#xff0c;关闭登录界面&#xff0c;跳转到其他界面 如果账号和密码不匹配&#xf…...

HTTP协议在Linux上进行数据库访问代码示例

在Linux上使用HTTP协议进行数据库访问通常涉及到使用库如requests来进行HTTP请求&#xff0c;以及使用json或类似的库来处理返回的数据。下面是一个使用Python的简单示例&#xff0c;展示如何通过HTTP协议在Linux上访问数据库。 首先&#xff0c;你需要确保你的Linux系统上已经…...

CS.DEEP | 基于 openGauss 实现的计算机论坛项目

前言 本项目是一个基于前后端分离&#xff08;后端&#xff1a;SpringBoot openGauss&#xff0c;前端&#xff1a;Vue3 Element Plus&#xff09;实现的开源计算机博客论坛项目&#xff0c;旨在为用户提供一个方便、高效的博客发布和交流平台。 本平台支持 Markdown 编辑&…...

【ArcGIS Pro微课1000例】0053:基于SQL Server创建与启用地理数据库

之前的文章有讲述基于SQL Server创建企业级地理数据库,本文讲述在SQL Server中创建常规的关心数据库,然后在ArcGIS Pro中将其启用,转换为企业级地理数据库。 1. 在SQL Server中创建数据库** 打开SQL Server 2019,连接到数据库服务器。 展开数据库连接,在数据库上右键→新…...

快速排序(2)

一、快速排序有三种方法&#xff1a;hoare版本、挖坑法、前后指针版本 但是三种方法的核心思想都是一样的&#xff0c;都是将该数组分为左右两半递归式的排序。 1.hoare版本 该方法是先保存a[keyi]位置的值&#xff0c;然后右边先开动找小&#xff0c;找到小后&#xff0c;左…...

持续集成和持续交付

引言 CI/CD 是一种通过在应用开发阶段引入自动化来频繁向客户交付应用的方法。CI/CD 的核心概念是持续集成、持续交付和持续部署。作为一种面向开发和运维团队的解决方案&#xff0c;CI/CD 主要针对在集成新代码时所引发的问题&#xff08;亦称&#xff1a;“集成地狱”&#…...

C#、JavaScript、VBScript解析JSON数据源码

本示例使用设备&#xff1a;WIFI/TCP/UDP/HTTP协议RFID液显网络读卡器可二次开发语音播报POE-淘宝网 (taobao.com) C#解析JSON数据 string dispstr "{" getChinesecode("扫码") ":}" data; //显示信息,注意中文汉字一定要转换为设备能显…...

JVM面试连环炮:你准备好迎接挑战了吗?

在Java开发领域&#xff0c;JVM面试一直是一个热门话题。作为一名优秀的开发者&#xff0c;你是否已经准备好迎接这场挑战了呢&#xff1f;今天&#xff0c;我们就来深度解析一下JVM面试的热点问题&#xff0c;帮助你更好地应对面试&#xff0c;一举拿下offer&#xff01; 1、…...

Ansible通过kubernetes.core.k8s_info和kubernetes.core.k8s访问OCP

文章目录 环境OCPClient&#xff08;Ansible控制节点&#xff09; 步骤准备工作在client端配置ssh免密登录OCP端在client端安装Ansible kubernetes.core.k8s_info第1次尝试在OCP端安装python和pip3在OCP端安装kubernetes在OCP端安装PyYAML第2次尝试在OCP端配置config文件第3次尝…...

vscode汉化

安装插件 Chinese (Simplified) (简体中文) Language Pack for 重新打开&#xff0c;若还是没有汉化&#xff1a; 【CtrlShiftp】 输入“configure display language”&#xff0c;回车键 选择刚刚安装的 中文(简体)...

美易投资:美国圣诞树价格飙升,涨价的问题所在?

美国圣诞树价格飙升&#xff0c;商家称“拜登经济学”是导致涨价的罪魁祸首 随着圣诞节的临近&#xff0c;美国各地的家庭开始准备庆祝这一传统佳节。然而&#xff0c;今年美国的圣诞树价格却呈现出了明显的上涨趋势。据一些商家反映&#xff0c;这主要是由于“拜登经济学”所致…...

国内外聊天AI大比拼,你知道几个?一键了解最火聊天AI应用!

国内类ChatGPT的AI工具一网打尽 2022年&#xff0c;是一个不平凡的一年。ChatGPT迅速崭露头角&#xff0c;成为备受瞩目的热门话题。特别是在OpenAI发布了基于GPT-3.5模型的ChatGPT版本后&#xff0c;这一产品因其卓越的对话能力和广泛的应用潜力&#xff0c;很快引起了大众的…...

C++STL的vector模拟实现

文章目录 前言成员变量成员函数构造函数push_backpop_backinserterase析构函数拷贝构造 前言 成员变量 namespace but {template<class T>class vector{public:typedef T* iterator;private:iterator _start;iterator _finish;iterator _end_of_storage;}; }我们之前实…...

openssl 常用命令 pkcs12

openssl pkcs12 openssl pkcs12 官方文档 1. 描述 The pkcs12 command allows PKCS#12 files (sometimes referred to as PFX files) to be created and parsed. PKCS#12 files are used by several programs including Netscape, MSIE and MS Outlook. pkcs12 命令是用来创…...

2017下半年软工(桥接模式)

题目——桥接模式&#xff08;抽象调用实现部分&#xff09; package org.example.桥接模式;/*** 桥接模式的核心思想是将抽象部分与它的实现部分分离&#xff0c;使它们可以独立变化&#xff0c;就是说你在实现部分&#xff1a;WinImp、LinuxImp基础上还能加上RedHatImp&#…...

Hive 浅析

Hive是一个简单的LUA沙盒&#xff0c;除了基本的LUA解释器的功能以外&#xff0c;还提供了诸如热加载等功能。 了解HIVE的工作原理有利于了解Lua虚拟机的底层实现机理。 本文从是什么-怎么用-为什么三个维度介绍HIVE。 Hive Hive是什么 hive是一个简单的LUA应用框架,目前基于…...

C 语言中,结构体「.」与「->」的区别

简单来说 「 」的左边是结构体名字时用点符号「.」 「 」的左边是结构体指针时名字时用箭头「->」 对于要读取结构体种的数据时&#xff0c;有下面三种写法&#xff0c;操作是等价的。 struct ListNode a;struct ListNode *p1 &a;/*三种写法*/a.element 2333;p1->e…...

【Java Web学习笔记】5 - XML

项目代码 https://github.com/yinhai1114/JavaWeb_LearningCode/tree/main/xml 零、在线文档 XML系列教程 一、XML引出 1.为什么需要XML 1.需求1 :两个程序间进行数据通信? 2.需求2:给一台服务器&#xff0c;做一个配置文件&#xff0c;当服务器程序启动时&#xff0c;去…...

在jupyter notebook中修改其他文件的解决方案

大家好,我是爱编程的喵喵。双985硕士毕业,现担任全栈工程师一职,热衷于将数据思维应用到工作与生活中。从事机器学习以及相关的前后端开发工作。曾在阿里云、科大讯飞、CCF等比赛获得多次Top名次。现为CSDN博客专家、人工智能领域优质创作者。喜欢通过博客创作的方式对所学的…...

如何在Android中旋转屏幕时避免重新绘制Activity

如何在Android中旋转屏幕时避免重新绘制Activity 在Android开发中&#xff0c;设备旋转通常导致当前活动&#xff08;Activity&#xff09;被销毁并重新创建&#xff0c;这可能导致用户界面重置和不必要的资源重新加载。然而&#xff0c;有时我们希望避免这种行为&#xff0c;…...

离线环境下安装python库(推荐pip download)

离线环境下安装python库&#xff08;推荐pip download&#xff09; 目录 1.需求 2.失败操作&#xff08;注意&#xff09; 3.成功操作 4.其它参考 1.需求 机器部署web系统环境后&#xff0c;就不可再次联网&#xff0c;所以升级python web后端&#xff0c;需要离线安装pyt…...

ubuntu16.04安装ROS+Gazebo

ubuntu16.04安装ROS参考文章 ros安装&#xff08;一键最简安装&#xff0c;吹爆鱼香ROS&#xff0c;请叫我鱼吹&#xff09; ROS篇——Ubuntu快速一键安装ROS或ROS2&#xff08;通用&#xff09; ubuntu安装ROS melodic(最新、超详细图文教程) 配置ubuntu以及安装ros2必要环…...