Mysql高级——Mysql8一主一从,多主多从搭建

修改 /etc/hosts文件

ip地址 master1
ip地址 master2
ip地址 slave1
ip地址 slave2

一主一从

create database master1db;create table master1db.master1tab(name char(50));insert into master1db.master1tab VALUES(1111);insert into master1db.master1tab VALUES(2222);

master1 日志

[root@localhost opt]# vim /etc/my.cnf
[root@localhost opt]# cat /etc/my.cnf[mysqld]datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.socklog-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
log_bin
server-id=1
systemctl restart mysqld

创建用户

create user 'rep'@'192.168.18.%' identified by '123321zk';
grant replication slave,replication client on *.* to 'rep'@'192.168.18.%';alter user 'rep'@'192.168.18.%' identified with  mysql_native_password  by '123321zk';

master1上备份数据库

[root@localhost opt]# mysqldump -uroot -p'123321zk' --all-databases --single-transaction --master-data=2 --flush-logs > `date +%F`-mysql-all.sql[root@localhost opt]# ls
2023-10-12                                              mysql-community-common-8.0.25-1.el7.x86_64.rpm
2023-10-12-mysql-all.sql                                mysql-community-libs-8.0.25-1.el7.x86_64.rpm
mysql-community-client-8.0.25-1.el7.x86_64.rpm          mysql-community-server-8.0.25-1.el7.x86_64.rpm
mysql-community-client-plugins-8.0.25-1.el7.x86_64.rpm  rh

从机master2登录

[root@localhost opt]# mysql -urep -p'123321zk' -h master1;
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 16
Server version: 8.0.25 MySQL Community Server - GPLCopyright (c) 2000, 2021, 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> 

修改master2的配置文件

[root@localhost opt]# vim /etc/my.cnf
[root@localhost opt]# cat /etc/my.cnf[mysqld]datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.socklog-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
server-id=2
systemctl restart mysqld

master2用root登录

[root@localhost opt]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.25 MySQL Community Server - GPLCopyright (c) 2000, 2021, 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> 

手动同步数据

复制master1的sql文件到matser2上

[root@localhost opt]# scp 2023-10-12-mysql-all.sql  master2:/opt
The authenticity of host 'master2 (192.168.18.131)' can't be established.
ECDSA key fingerprint is 83:bc:ac:37:44:8d:ea:4f:c7:c5:f7:2b:c5:0c:ee:b4.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'master2,192.168.18.131' (ECDSA) to the list of known hosts.
root@master2's password: 
2023-10-12-mysql-all.sql                                                                     100% 1190KB   1.2MB/s   00:00    
[root@localhost opt]# 

master2查看

[root@localhost opt]# ls
2023-10-12-mysql-all.sql                                mysql-community-common-8.0.25-1.el7.x86_64.rpm  rh
mysql-community-client-8.0.25-1.el7.x86_64.rpm          mysql-community-libs-8.0.25-1.el7.x86_64.rpm
mysql-community-client-plugins-8.0.25-1.el7.x86_64.rpm  mysql-community-server-8.0.25-1.el7.x86_64.rpm

master2上root用户执行

mysql> source /opt/2023-10-12-mysql-all.sql;
Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)
.....# 查询成功!
mysql> select * from master1db.master1tab;
+------+
| name |
+------+
| 1111 |
| 2222 |
+------+
2 rows in set (0.00 sec)

配置日志偏移量

mysql> change master to master_host='master1',master_user='rep',master_password='123321zk',master_log_file='localhost-bin.000002',master_log_pos=156;
Query OK, 0 rows affected, 8 warnings (0.05 sec)

启动从机master2

mysql> start slave;
Query OK, 0 rows affected, 1 warning (0.00 sec)

master1查看偏移量

mysql> show master status;
+----------------------+----------+--------------+------------------+-------------------+
| File                 | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+----------------------+----------+--------------+------------------+-------------------+
| localhost-bin.000002 |      448 |              |                  |                   |
+----------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)

master2更新偏移量

mysql> change master to master_host='master1',master_user='rep',master_password='123321zk',master_log_file='localhost-bin.000002',master_log_pos=448;
Query OK, 0 rows affected, 8 warnings (0.05 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 master to send eventMaster_Host: master1Master_User: repMaster_Port: 3306Connect_Retry: 60Master_Log_File: localhost-bin.000002Read_Master_Log_Pos: 448Relay_Log_File: localhost-relay-bin.000002Relay_Log_Pos: 328Relay_Master_Log_File: localhost-bin.000002Slave_IO_Running: YesSlave_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: 448Relay_Log_Space: 541Until_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: 0Last_IO_Error: Last_SQL_Errno: 0Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 1Master_UUID: d4996f86-68fd-11ee-ae55-000c29980ceaMaster_Info_File: mysql.slave_master_infoSQL_Delay: 0SQL_Remaining_Delay: NULLSlave_SQL_Running_State: Slave has read all relay log; waiting for more updatesMaster_Retry_Count: 86400Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: Executed_Gtid_Set: Auto_Position: 0Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: Master_public_key_path: Get_master_public_key: 0Network_Namespace: 
1 row in set, 1 warning (0.00 sec)ERROR: 
No query specifiedmysql> 

双主双从

修改master1的配置文件

[root@localhost ~]# vim /etc/my.cnf[mysqld]datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.socklog-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pidlog-bin=/var/lib/mysql/binlog
server-id=1
# 跳过不备份数据库
binlog-ignore-db=mysql
binlog-ignore-db=information_schema
# 数据库
binlog-do-db=mydb2
# 日志格式
binlog_format=statement
# 过期时间
expire_logs_days=7
slave_skip_errors=1062
# 作为从数据库 写入操作也要更新二进制文件
log-slave-updates
# 标识自增长字段每次递增的量 就是步长
auto-increment-increment=2
# 表示自增从哪个数开始
auto-increment-offset=1

重启master1数据库

systemctl restart mysqld

修改master2配置文件

[root@localhost ~]# cat /etc/my.cnf[mysqld]datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.socklog-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pidlog-bin=/var/lib/mysql/binlog
server-id=3
# 跳过不备份数据库
binlog-ignore-db=mysql
binlog-ignore-db=information_schema
# 数据库
binlog-do-db=mydb2
# 日志格式
binlog_format=statement
# 过期时间
expire_logs_days=7
slave_skip_errors=1062
# 作为从数据库 写入操作也要更新二进制文件
log-slave-updates
# 标识自增长字段每次递增的量 就是步长
auto-increment-increment=2
# 表示自增从哪个数开始
auto-increment-offset=2
systemctl restart mysqld

更改slave1配置文件

[root@localhost ~]# cat /etc/my.cnf[mysqld]datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.socklog-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid# 服务id
server-id=2
# 启用中继日志
relay-log=mysql-relay

更改slave2配置文件

[mysqld]datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.socklog-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid# 服务id
server-id=4
# 启用中继日志
relay-log=mysql-relay

分别重启slave1和slave2

systemctl restart mysqld

master1,master2配置 创建用户并授权 两个主数据库都要创

mysql> CREATE USER 'repl_user'@'%' IDENTIFIED WITH mysql_native_password BY '123321zk';
Query OK, 0 rows affected (0.01 sec)mysql> CREATE USER 'slave_sync_user'@'%' IDENTIFIED WITH mysql_native_password BY '123321zk';
Query OK, 0 rows affected (0.00 sec)mysql> GRANT REPLICATION SLAVE ON *.* TO 'repl_user'@'%';
Query OK, 0 rows affected (0.00 sec)mysql> GRANT REPLICATION SLAVE ON *.* TO 'slave_sync_user'@'%';
Query OK, 0 rows affected (0.01 sec)

在这里插入图片描述

主1从1

查看master1的偏移量

mysql> show master status;
+---------------+----------+--------------+--------------------------+-------------------+
| File          | Position | Binlog_Do_DB | Binlog_Ignore_DB         | Executed_Gtid_Set |
+---------------+----------+--------------+--------------------------+-------------------+
| binlog.000003 |     1198 | mydb2        | mysql,information_schema |                   |
+---------------+----------+--------------+--------------------------+-------------------+
1 row in set (0.00 sec)

修改slave1 配置主master1从关系

mysql> change master to master_host='master1',master_user='slave_sync_user',master_password='123321zk',master_log_file='binlog.000003',master_log_pos=1198;
Query OK, 0 rows affected, 8 warnings (0.51 sec)

启动slave1

mysql> start slave;
Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> show slave status\G;
*************************** 1. row ***************************Slave_IO_State: Waiting for master to send eventMaster_Host: master1Master_User: slave_sync_userMaster_Port: 3306Connect_Retry: 60Master_Log_File: binlog.000003Read_Master_Log_Pos: 1198Relay_Log_File: mysql-relay.000002Relay_Log_Pos: 321Relay_Master_Log_File: binlog.000003Slave_IO_Running: YesSlave_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: 1198Relay_Log_Space: 526Until_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: 0Last_IO_Error: Last_SQL_Errno: 0Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 1Master_UUID: d4996f86-68fd-11ee-ae55-000c29980ceaMaster_Info_File: mysql.slave_master_infoSQL_Delay: 0SQL_Remaining_Delay: NULLSlave_SQL_Running_State: Slave has read all relay log; waiting for more updatesMaster_Retry_Count: 86400Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: Executed_Gtid_Set: Auto_Position: 0Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: Master_public_key_path: Get_master_public_key: 0Network_Namespace: 
1 row in set, 1 warning (0.00 sec)
主2从2

主2msql 作为主服务器

从2mysql作为从服务器

查看master2状态

mysql> show master status;
+---------------+----------+--------------+--------------------------+-------------------+
| File          | Position | Binlog_Do_DB | Binlog_Ignore_DB         | Executed_Gtid_Set |
+---------------+----------+--------------+--------------------------+-------------------+
| binlog.000002 |     1654 | mydb2        | mysql,information_schema |                   |
+---------------+----------+--------------+--------------------------+-------------------+
1 row in set (0.00 sec)

修改slave2 配置主master2从关系

mysql> change master to master_host='master2',master_user='slave_sync_user',master_password='123321zk',master_log_file='binlog.000002',master_log_pos=1654;
Query OK, 0 rows affected, 8 warnings (0.51 sec)

启动slave2

mysql> start slave;
Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> show slave status\G;
*************************** 1. row ***************************Slave_IO_State: Waiting for master to send eventMaster_Host: master2Master_User: slave_sync_userMaster_Port: 3306Connect_Retry: 60Master_Log_File: binlog.000002Read_Master_Log_Pos: 1654Relay_Log_File: mysql-relay.000002Relay_Log_Pos: 321Relay_Master_Log_File: binlog.000002Slave_IO_Running: YesSlave_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: 1654Relay_Log_Space: 526Until_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: 0Last_IO_Error: Last_SQL_Errno: 0Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 3Master_UUID: d5b21ed3-68fd-11ee-b692-000c29dadb21Master_Info_File: mysql.slave_master_infoSQL_Delay: 0SQL_Remaining_Delay: NULLSlave_SQL_Running_State: Slave has read all relay log; waiting for more updatesMaster_Retry_Count: 86400Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: Executed_Gtid_Set: Auto_Position: 0Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: Master_public_key_path: Get_master_public_key: 0Network_Namespace: 
1 row in set, 1 warning (0.01 sec)
主1主2

修改master2 从master1

mysql> change master to master_host='master1',master_user='repl_user',master_password='123321zk',master_log_file='binlog.000003',master_log_pos=1198;
Query OK, 0 rows affected, 8 warnings (0.73 sec)mysql> start slave;
Query OK, 0 rows affected, 1 warning (0.02 sec)mysql> show slave status\G;
*************************** 1. row ***************************Slave_IO_State: Waiting for master to send eventMaster_Host: master1Master_User: repl_userMaster_Port: 3306Connect_Retry: 60Master_Log_File: binlog.000003Read_Master_Log_Pos: 1198Relay_Log_File: localhost-relay-bin.000002Relay_Log_Pos: 321Relay_Master_Log_File: binlog.000003Slave_IO_Running: YesSlave_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: 1198Relay_Log_Space: 534Until_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: 0Last_IO_Error: Last_SQL_Errno: 0Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 1Master_UUID: d4996f86-68fd-11ee-ae55-000c29980ceaMaster_Info_File: mysql.slave_master_infoSQL_Delay: 0SQL_Remaining_Delay: NULLSlave_SQL_Running_State: Slave has read all relay log; waiting for more updatesMaster_Retry_Count: 86400Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: Executed_Gtid_Set: Auto_Position: 0Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: Master_public_key_path: Get_master_public_key: 0Network_Namespace: 
1 row in set, 1 warning (0.00 sec)
主2主1

修改master1 从master2

master2查看

mysql> show master status;
+---------------+----------+--------------+--------------------------+-------------------+
| File          | Position | Binlog_Do_DB | Binlog_Ignore_DB         | Executed_Gtid_Set |
+---------------+----------+--------------+--------------------------+-------------------+
| binlog.000002 |     1654 | mydb2        | mysql,information_schema |                   |
+---------------+----------+--------------+--------------------------+-------------------+
1 row in set (0.00 sec)

修改master1 从master2

mysql> change master to master_host='master2',master_user='repl_user',master_password='123321zk',master_log_file='binlog.000002',master_log_pos=1654;
Query OK, 0 rows affected, 8 warnings (0.12 sec)mysql> start slave;
Query OK, 0 rows affected, 1 warning (0.01 sec)mysql> show slave status\G;
*************************** 1. row ***************************Slave_IO_State: Waiting for master to send eventMaster_Host: master2Master_User: repl_userMaster_Port: 3306Connect_Retry: 60Master_Log_File: binlog.000002Read_Master_Log_Pos: 1654Relay_Log_File: localhost-relay-bin.000002Relay_Log_Pos: 321Relay_Master_Log_File: binlog.000002Slave_IO_Running: YesSlave_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: 1654Relay_Log_Space: 534Until_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: 0Last_IO_Error: Last_SQL_Errno: 0Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 3Master_UUID: d5b21ed3-68fd-11ee-b692-000c29dadb21Master_Info_File: mysql.slave_master_infoSQL_Delay: 0SQL_Remaining_Delay: NULLSlave_SQL_Running_State: Slave has read all relay log; waiting for more updatesMaster_Retry_Count: 86400Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: Executed_Gtid_Set: Auto_Position: 0Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: Master_public_key_path: Get_master_public_key: 0Network_Namespace: 
1 row in set, 1 warning (0.00 sec)

在master1上创建数据库

CREATE DATABASE mydb2;
CREATE TABLE mydb2.books (
id INT PRIMARY KEY auto_increment,
name VARCHAR ( 50 ));
INSERT INTO mydb2.books ( NAME )
VALUES
( 'test mysql' );

查看其余数据库是否同步

全部同步成功

在这里插入图片描述

解决问题参考链接

主从同步报错Last_IO_Error: error connecting to master ‘use@192.XXXX‘ - retry-time: 60 retries: 86400解决办法。-CSDN博客

MySQL主从复制报错:Got fatal error 1236 from master when reading data from-CSDN博客

解决mysql8.0主从配置,从库连接报错:Authentication plugin ‘caching_sha2_password‘ reported error_authentication plugin’caching-CSDN博客

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

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

相关文章

ARM 版 OpenEuler 22.03 部署 KubeSphere v3.4.0 不完全指南续篇

作者:运维有术 前言 知识点 定级:入门级KubeKey 安装部署 ARM 版 KubeSphere 和 KubernetesARM 版 KubeSphere 和 Kubernetes 常见问题 实战服务器配置 (个人云上测试服务器) 主机名IPCPU内存系统盘数据盘用途ks-master-1172.16.33.1661650200KubeSp…

苹果加大对印度的扶持,提高在其生产iphone的比重

KlipC报道:跟踪苹果产业链,有分析师预计2023年全球约12%-14%的iphone在印度生产,预计2024年,印度将生产20%-25%的iphone。 KlipC的合伙人Andi D表示:“近年来随着苹果对中国的以来,印度已经成为高科技制造和…

Linux开发板移植FTP服务器和OpenSSH时发现的问题

先上结论:如果在linux开发板上移植了OpenSSH,那么不仅可以远程登录Linux开发板,还可以用FileZilla在windows和Linux开发板之间传输文件,这时候就不需要移植vsftpd(移植vsftpd后windows可以用FileZilla跟Linux开发板传输文件)了&am…

甘特图组件DHTMLX Gantt用例 - 如何拆分任务和里程碑项目路线图

创建一致且引人注意的视觉样式是任何项目管理应用程序的重要要求,这就是为什么我们会在这个系列中继续探索DHTMLX Gantt图库的自定义。在本文中我们将考虑一个新的甘特图定制场景,DHTMLX Gantt组件如何创建一个项目路线图。 DHTMLX Gantt正式版下载 用…

AI 绘画 | Stable Diffusion 提示词

Prompts提示词简介 在Stable Diffusion中,Prompts是控制模型生成图像的关键输入参数。它们是一种文本提示,告诉模型应该生成什么样的图像。 Prompts可以是任何文本输入,包括描述图像的文本,如“一只橘色的短毛猫,坐在…

RFID管理方案有效提升电力物资管理效率与资产安全

在电力行业,电力资产的管理是一项重要的任务,为了实现对电力资产的精细化管理、入出库监控管理、盘点管理和巡查管理等,电力公司多采用电力资产RFID管理系统,该系统能够实时监控出入库过程,有效防止出入库错误&#xf…

基于卷积神经网络的抗压强度预测,基于卷积神经网络的抗折强度预测

目录 背影 卷积神经网络CNN的原理 卷积神经网络CNN的定义 卷积神经网络CNN的神经元 卷积神经网络CNN的激活函数 卷积神经网络CNN的传递函数 卷积神经网络CNN抗压强度预测 完整代码:基于卷积神经网络的抗压强度和抗折强度预测,基于CNN的抗压强度和抗折强度预测(代码完整,数据…

红黑树——插入底层实现【C++】面试重灾区!!

目录 前言 一,概念 定义 二,insert 情况一:仅染色 情况二:单旋 染色 情况三:双旋 染色 insert代码 三, 红黑树验证(面试题) 产生随机数验证 四,删除 下期预告:用红黑…

基于跳蛛算法的无人机航迹规划-附代码

基于跳蛛算法的无人机航迹规划 文章目录 基于跳蛛算法的无人机航迹规划1.跳蛛搜索算法2.无人机飞行环境建模3.无人机航迹规划建模4.实验结果4.1地图创建4.2 航迹规划 5.参考文献6.Matlab代码 摘要:本文主要介绍利用跳蛛算法来优化无人机航迹规划。 1.跳蛛搜索算法 …

Python 生成Android不同尺寸的图标

源代码 # -*- coding: utf-8 -*- import sys import os import shutil from PIL import Imagedef generateAndroidIcons():imageSource icon.pngicon Image.open(imageSource)sizes [(android/drawable,512),(android/drawable-hdpi,72),(android/drawable-ldpi,36),(andro…

晨控CK-GW08系列网关控制器与CODESYS软件MODBUSTCP通讯手册

晨控CK-GW08系列是一款支持标准工业通讯协议ModbusTCP的网关控制器,方便用户集成到PLC等控制系统中。系统还集成了8路读写接口,用户可通过通信接口使用Modbus TCP协议对8路读写接口所连接的读卡器进行相对独立的读写操作。 晨控CK-GW08系列网关控制器适用于本公司多…

Docker 学习路线 5:在 Docker 中实现数据持久化

Docker 可以运行隔离的容器,包括应用程序和其依赖项,与主机操作系统分离。默认情况下,容器是临时的,这意味着容器中存储的任何数据在终止后都将丢失。为了解决这个问题并在容器生命周期内保留数据,Docker 提供了各种数…

应用安全四十二:SSO安全

一、什么是SSO SSO是单点登录(Single Sign On)的缩写,是指在多个应用系统中,用户只需要登录一次就可以访问所有相互信任的应用系统。这种方式减少了由登录产生的时间消耗,辅助了用户管理,是比较流行的企业业务整合的解决方案之一。 身份验证过程依赖于双方之间的信任关…

【Redis】hash类型-内部编码使用场景

文章目录 内部编码测试内部编码: 使用场景缓存方式对比 内部编码 哈希的内部编码有两种: ziplist(压缩列表):当哈希类型元素个数⼩于hash-max-ziplist-entries配置(默认512个)、同时所有值都⼩…

Python类继承(单继承)

自定义“鸟”类,“鸣禽”、“猛禽”继承自“鸟”类,“画眉”、“百灵”继承自“鸣禽”,“鹰”、“雕”继承自“猛禽”。 (笔记模板由python脚本于2023年11月06日 19:08:56创建,本篇笔记适合初通Python类的coder翻阅) 【学习的细节…

React使用富文本CKEditor 5,上传图片并可设置大小

上传图片 基础使用(标题、粗体、斜体、超链接、缩进段落、有序无序、上传图片) 官网查看:https://ckeditor.com/docs/ckeditor5/latest/installation/integrations/react.html 安装依赖 npm install --save ckeditor/ckeditor5-react cked…

cookie、session和Token的区别?JWT又是什么?单点登录又是什么?头大?快进来看看,一文帮你捋清楚~

目录 0、HTTP是无状态的 1、前端标记cookie 1.1、cookie限制空间范围 1.2、cookie限制时间范围 1.3、cookie限制使用方式 2、服务端存储session库 2.1、我们先来简单聊聊session是什么? 2.2、session的存储方式 2.3、session的过期和销毁 2.4、session的分…

hugetlb核心组件

1 概述 hugetlb机制是一种使用大页的方法,与THP(transparent huge page)是两种完全不同的机制,它需要: 管理员通过系统接口reserve一定量的大页,用户通过hugetlbfs申请使用大页, 核心组件如下图: 围绕着…

十年老程序员分享13个最常用的Python深度学习库和介绍,赶紧收藏码住!

文章目录 前言CaffeTheanoTensorFlowLasagneKerasmxnetsklearn-theanonolearnDIGITSBlocksdeepypylearn2Deeplearning4j关于Python技术储备一、Python所有方向的学习路线二、Python基础学习视频三、精品Python学习书籍四、Python工具包项目源码合集①Python工具包②Python实战案…

选择合适的Python Web框架

Python 是一种功能强大的编程语言,广泛应用于 Web 开发领域。FastAPI 和 Flask 是 Python Web 开发中最受欢迎的两个框架。本文将对 FastAPI 和 Flask 进行综合对比,探讨它们在语法和表达能力、生态系统和社区支持、性能和扩展性、开发工具和调试支持、安…