MySQL的主从复制与主从切换详解

MySQL的主从复制与主从切换详解

  • 一、MySql主从节点的搭建
    • 一、 master主节点的搭建
        • 1. 查看是否开启bin_log日志
        • 2. MySQL开启log_bin功能
        • 3. 创建主从复制用户并授权
        • 4. mysql数据库状态查看
        • 5. 主节点锁表并进行数据备份
    • 二、solve从节点的搭建
        • 1. 配置文件添加内容
        • 2. 同步主库数据并授权
        • 3. 主库解除锁定
        • 4. 开启从节点
        • 5. 检查从节点状态
        • 6. 确认主从复制开启成功
          • 1. 查看主节点相关信息
          • 2. 查看从节点相关信息
  • 二、主从同步失败问题定位,Slave_IO_Running: No
  • 三、MSQL主从切换操作
    • 1、 从库100.66.101.5上执行操作如下
    • 2、主库100.66.100.64执行操作如下

一、MySql主从节点的搭建

一、 master主节点的搭建

1. 查看是否开启bin_log日志

注: 若log_bin为ON表示已启用bin_log日志,为OFF表示未开启,则需执行下一步开启log_bin功能

mysql> show global variables like 'log_bin%';
+---------------------------------+------------------------------+
| Variable_name                   | Value                        |
+---------------------------------+------------------------------+
| log_bin                         | ON                           |# ON为开启,OFF关闭
| log_bin_basename                | /mysqld/data/mysql-bin       |
| log_bin_index                   | /mysqld/data/mysql-bin.index |
| log_bin_trust_function_creators | OFF                          |
| log_bin_use_v1_row_events       | OFF                          |
+---------------------------------+------------------------------+
2. MySQL开启log_bin功能
  • 修改mysql配置文件my.cnf 添加内容如下
[root@localhost ~]# vi my.cnf
[mysqld]
log-bin=mysql-bin  #指定并激活mysql二进制文件名称
server-id = 1   #设置server-id 为1 代表开启二进制,若为0代表禁止二进制,mysql8.0默认为1,8.0以前默认为0
  • 此台服务器mysql完整配置在这里!
[mysqld]
skip-name-resolve
default_storage_engine = InnoDB
basedir = /opt/rdapp/mysqld
datadir = /opt/rdapp/mysqld/data
port=3306
#socket = /opt/rdapp/mysqld/pid/mysql.sock
pid-file = /opt/rdapp/mysqld/pid/mysql.pid
log-error = /opt/rdapp/mysqld/logs/err.log
log_error_verbosity = 3
default_authentication_plugin = mysql_native_password
skip-log-bin
back_log = 600                  #mysql等待连接的堆栈大小
lower_case_table_names = 1      #不区分表的大小写
max_allowed_packet = 1024M      #接收数据包的大小
binlog_cache_size = 8M
max_connections = 1000          #最大连接数
open_files_limit = 65535                #打开文件描述符限制
table_open_cache = 1024         #表缓存
read_buffer_size = 2M           #读入缓冲区大小
read_rnd_buffer_size = 8M       #随机读取缓冲区大小
sort_buffer_size = 8M           #执行排序使用的缓冲区大小
join_buffer_size = 8M           #联合查询操作使用的缓冲区大小
thread_cache_size = 64          #可以重新利用保存在缓存中线程的数量
key_buffer_size = 4M            #指定���于索引的缓冲区大小
slow_query_log = 1              #慢日志
long_query_time = 3             #慢查询时间,超过3秒则为慢查询
slow_query_log_file= /opt/rdapp/mysqld/logs/slow.log    #慢日志保存位置
default-storage-engine = InnoDB #默认存储引擎
innodb_buffer_pool_size = 512M  #innodb缓冲池大小
innodb_write_io_threads = 4
innodb_read_io_threads = 4
innodb_thread_concurrency = 0   #默认为0,表示不限制并发数
innodb_purge_threads = 1
innodb_flush_log_at_trx_commit = 2      #日志刷新级别
innodb_log_buffer_size = 2M
innodb_log_file_size = 64M
innodb_log_files_in_group = 3   #以以循环方式将日志文件写到多个文件。推荐设置为3
innodb_max_dirty_pages_pct = 90 #innodb主线程刷新缓存池中的数据,使脏数据比例小于90%
innodb_lock_wait_timeout = 120  #InnoDB事务在被回滚之前可以等待一个锁定的超时秒数
log_bin = mysql-bin
#binlog_format = mixed
binlog_expire_logs_seconds = 2592000            #超过30天的binlog删除
log-bin-trust-function-creators = 1
sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"
character_set_server = utf8mb4
#collation_server = utf8mb4_general_ci
general_log = on
general_log_file = /opt/rdapp/mysqld/logs/general.log
plugin-load-add = connection_control.so
interactive_timeout = 900
wait_timeout = 900
connection_control_failed_connections_threshold = 0
connection_control_min_connection_delay = 15000
connection_control_max_connection_delay = 30000
#skip-name-resolve
#host_cache_size=10#MGR集群
disabled_storage_engines = "MyISAM,BLACKHOLE,FEDERATED,ARCHIVE,MEMORY"
server_id = 2
gtid_mode = ON
enforce_gtid_consistency = ON
binlog_checksum = NONE
log_slave_updates = ON
binlog_format = ROW
#sql_require_primary_key = ON
master_info_repository = TABLE
relay_log_info_repository = TABLE
transaction_write_set_extraction = XXHASH64
plugin_load_add='group_replication.so'
group_replication_group_name = "f5b933ac-d49d-11eb-b9bf-005056863e69"
group_replication_start_on_boot = on
group_replication_local_address = "mysqlnode2.service.rdapp.internal:33061"
group_replication_group_seeds = "mysqlnode1.service.rdapp.internal:33061,mysqlnode2.service.rdapp.internal:33061"
group_replication_bootstrap_group = off
report_host = "mysqlnode2.service.rdapp.internal"
group_replication_transaction_size_limit =  150000000   #组复制最大事务大小大小限制
group_replication_consistency = before
group_replication_communication_max_message_size = 10M
group_replication_flow_control_certifier_threshold = 25000
group_replication_autorejoin_tries = 10
group_replication_member_expel_timeout = 60
binlog_transaction_dependency_tracking = writeset
slave_parallel_type = LOGICAL_CLOCK
slave_preserve_commit_order = ON
slave_checkpoint_period = 2
slave_checkpoint_group = 256[client]
port = 3306
socket = /opt/rdapp/mysqld/pid/mysql.sock[mysqldump]
quick
max_allowed_packet = 512M #服务器发送和接受的最大包长度
[myisamchk]
key_buffer_size = 8M
sort_buffer_size = 8M
read_buffer = 4M
write_buffer = 4M
3. 创建主从复制用户并授权
# 登录作为主节点的mysql
[root@localhost mysqld]# /opt/rdapp/mysqld/mysqld-os/mysqld/bin/mysql -h 10.8.109.165  -urdapp -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.25 MySQL Community Server - GPL
Copyright (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内输入下面的命令
mysql> create user 'repl'@'%' identified by 'Nucleus!';
Query OK, 0 rows affected (0.02 sec)mysql> grant replication slave on *.* to 'repl'@'%';
Query OK, 0 rows affected (0.01 sec)mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.41 sec)mysql> select user,host from  mysql.user;
+------------------+-----------+
| user             | host      |
+------------------+-----------+
| hl               | %         |
| rdapp            | %         |
| repl             | %         |
| auditor          | 127.0.0.1 |
| reraat           | 127.0.0.1 |
| security         | 127.0.0.1 |
| systemadmin      | 127.0.0.1 |
| mysql.infoschema | localhost |
| mysql.session    | localhost |
| mysql.sys        | localhost |
| rdapp            | localhost |
+------------------+-----------+
11 rows in set (0.00 sec)
4. mysql数据库状态查看
# 查看mysql的数据库
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)# 查看log_bin信息
mysql> show global variables like 'log_bin%';
+---------------------------------+------------------------------+
| Variable_name                   | Value                        |
+---------------------------------+------------------------------+
| log_bin                         | ON                           |
| log_bin_basename                | /mysqld/data/mysql-bin       |
| log_bin_index                   | /mysqld/data/mysql-bin.index |
| log_bin_trust_function_creators | OFF                          |
| log_bin_use_v1_row_events       | OFF                          |
+---------------------------------+------------------------------+# 查看主节点的状态信息
mysql> show master status;
+------------------+----------+--------------+------------------+-------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000004 |      156 |              |                  |                   |
+------------------+----------+--------------+------------------+-------------------+
# mysql-bin.000004 指二进制的名称 
# 数据库的变更标识
# 复制哪个库
# 不允许复制哪个库
# 是否激活gtid
5. 主节点锁表并进行数据备份
  • 备份数据后面导入从节点,保证主从数据库起始数据一致
[root@localhost ~]# /opt/rdapp/mysqld/mysqld-os/mysqld/bin/mysql -h 10.8.109.165  -urdapp -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 17
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> FLUSH TABLES WITH READ LOCK;
Query OK, 0 rows affected (0.00 sec)
#数据备份
[root@localhost ~]# /opt/rdapp/mysqld/mysqld-os/mysqld/bin/mysqldump -h127.0.0.1 -ureraat -p --all-databases --triggers --routines --events  > /root/data.sql
Enter password:#解表
[root@localhost ~]# UNLOCK TABLES;

二、solve从节点的搭建

1. 配置文件添加内容
  • 修改mysql配置文件my.cnf 添加内容如下
[root@lopocalhost mysqld]# vi my.cnf                                                                                                                                                                                                                                                                    nnnnnnnn
[mysqld]
server-id = 21   # server-id必须是唯一的,与master节点不同就可以
2. 同步主库数据并授权
# 登录将作为从节点的mysql
[root@localhost mysqld]# /opt/rdapp/mysqld/mysqld-os/mysqld/bin/mysql -h 10.8.109.166  -urdapp -pxxx
# mysql内输入下面的命令
#  从库导入主库导出的数据data.sql,确保主从数据库内容一致
mysql> source /root/data.sql ;mysql> CHANGE MASTER TO-> master_host='10.8.109.165',-> MASTER_USER='repl',-> master_password='Nucleus!',-> MASTER_LOG_FILE='mysql-bin.000005',-> MASTER_LOG_POS=1;
Query OK, 0 rows affected, 7 warnings (0.00 sec)
3. 主库解除锁定
[root@localhost ~]# /opt/rdapp/mysqld/mysqld-os/mysqld/bin/mysql -h 10.8.109.165  -urdapp -pxxx
#解表
[root@localhost ~]# UNLOCK TABLES;
4. 开启从节点

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

5. 检查从节点状态
mysql> show slave status\G;
*************************** 1. row ***************************Slave_IO_State: Waiting for master to send eventMaster_Host: 10.8.109.165Master_User: replMaster_Port: 3306Connect_Retry: 60Master_Log_File: mysql-bin.000010Read_Master_Log_Pos: 156Relay_Log_File: localhost-relay-bin.000005Relay_Log_Pos: 371Relay_Master_Log_File: mysql-bin.000010Slave_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: 156Relay_Log_Space: 752Until_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: 400f2c2b-e2bb-11ee-8f85-00505686c1d1Master_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> show variables like 'server_uuid';
+---------------+--------------------------------------+
| Variable_name | Value                                |
+---------------+--------------------------------------+
| server_uuid   | 05e7063e-908d-11ec-9916-00505686574e |
+---------------+--------------------------------------+
1 row in set (0.00 sec)
6. 确认主从复制开启成功
1. 查看主节点相关信息
mysql> show processlist;
+----+-----------------+--------------------+------+-------------+------+---------------------------------------------------------------+------------------+
| Id | User            | Host               | db   | Command     | Time | State                 | Info             |
+----+-----------------+--------------------+------+-------------+------+---------------------------------------------------------------+------------------+
|  5 | event_scheduler | localhost          | NULL | Daemon      |  316 | Waiting on empty queue                 | NULL             |
| 14 | rdapp           | 10.8.109.165:44440 | NULL | Query       |    0 | init                 | show processlist |
| 19 | repl            | 10.8.109.166:48682 | NULL | Binlog Dump |  151 | Master has sent all binlog to slave; waitingfor more updates | NULL             |
+----+-----------------+--------------------+------+-------------+------+---------------------------------------------------------------+------------------+
3 rows in set (0.00 sec)mysql> show databases;
2. 查看从节点相关信息
mysql> show processlist;
+----+-----------------+--------------------+------+---------+------+--------------------------------------------------------+------------------+
| Id | User            | Host               | db   | Command | Time | State      | Info             |
+----+-----------------+--------------------+------+---------+------+--------------------------------------------------------+------------------+
|  5 | system user     | connecting host    | NULL | Connect |  132 | Waiting for master to send event      | NULL             |
|  6 | system user     |                    | NULL | Query   |  132 | Slave has read all relay log; waiting for more updates | NULL             |
|  7 | event_scheduler | localhost          | NULL | Daemon  |  132 | Waiting on empty queue      | NULL             |
| 11 | rdapp           | 10.8.109.165:38224 | orgs | Sleep   |    5 |      | NULL             |
| 15 | rdapp           | 10.8.109.166:40990 | NULL | Query   |    0 | init      | show processlist |
+----+-----------------+--------------------+------+---------+------+--------------------------------------------------------+------------------+
5 rows in set (0.00 sec)

二、主从同步失败问题定位,Slave_IO_Running: No

# "Slave_IO_Running:  Yes" 和 ”Slave_SQL_Running: Yes"  都是Yes才是正确的,否则都主从都有问题# 查看从节点状态
mysql> show slave status\G;
*************************** 1. row ***************************Slave_IO_State:Master_Host: 10.8.109.165Master_User: replMaster_Port: 3306Connect_Retry: 60Master_Log_File: mysql-bin.000005Read_Master_Log_Pos: 4Relay_Log_File: server2-relay-bin.000001Relay_Log_Pos: 4Relay_Master_Log_File: mysql-bin.000005Slave_IO_Running: No                   Slave_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: 4Relay_Log_Space: 156Until_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: NULL
Master_SSL_Verify_Server_Cert: NoLast_IO_Errno: 13117Last_IO_Error: Fatal error: The slave I/O thread stops because master and slave have equal MySQL server UUIDs; these UUIDs must be different for replication to work.    ## 停掉备库实例,删除备库 data 文件夹下的的 auto.cnf Last_SQL_Errno: 0Last_SQL_Error:Replicate_Ignore_Server_Ids:Master_Server_Id: 1Master_UUID:Master_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: 240315 10:44:01Last_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 specified问题:
*  Last_Error: Error 'Operation CREATE USER failed for 'repl'@'%'' on query. Default database: ''. Query: 'CREATE USER 'repl'@'%' IDENTIFIED WITH 'mysql_native_password' AS '*1E63BECE0EBF96B7F6F0167BB416443EF9079EB8''1. 查看server_id是否不同
mysql>  show variables like 'server_id';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id     | 2     |
+---------------+-------+
1 row in set (0.00 sec)2. 用户授权是否正确3. uuid也需要不同
解决方法:停掉备库实例,删除备库 data 文件夹下的的 auto.cnf
具体操作如下:
[root@localhost data]# ls
auto.cnf    client-cert.pem  #ib_16384_0.dblwr  ibdata1      ib_logfile2   master1.pid       mysql-bin.000006  performance_schema  server-cert.pem  undo_001
ca-key.pem  client-key.pem   #ib_16384_1.dblwr  ib_logfile0  ibtmp1        mysql             mysql-bin.index   private_key.pem     server-key.pem   undo_002
ca.pem      cms              ib_buffer_pool     ib_logfile1  #innodb_temp  mysql-bin.000005  mysql.ibd         public_key.pem      sys
[root@localhost data]# rm -rf auto.cnf
[root@localhost data]# systemctl restart mysqld
[root@localhost data]# /opt/rdapp/mysqld/mysqld-os/mysqld/bin/mysql -h 10.8.109.165  -urdapp -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 - GPL
Copyright (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.#查看uuid
mysql>  show variables like 'server_uuid';
+---------------+--------------------------------------+
| Variable_name | Value                                |
+---------------+--------------------------------------+
| server_uuid   | 400f2c2b-e2bb-11ee-8f85-00505686c1d1 |
+---------------+--------------------------------------+
1 row in set (0.01 sec)

三、MSQL主从切换操作

1、 从库100.66.101.5上执行操作如下

# 停止从库的运行
mysql> stop slave;
Query OK, 0 rows affected, 1 warning (0.00 sec)# 清空主从信息
mysql> reset slave all;
Query OK, 0 rows affected, 1 warning (0.00 sec)# 关闭只读开启读写,转为新主库
mysql>  set global read_only=off;
Query OK, 0 rows affected (0.00 sec)mysql>  set global super_read_only=off;
Query OK, 0 rows affected (0.00 sec)
# 查看二进制binlog文件的名称,此处是 mysql-bin.000006 (后面主节点切换到从要用)
mysql> show master status ;
+------------------+----------+--------------+------------------+--------------------------------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set                          |
+------------------+----------+--------------+------------------+--------------------------------------------+
| mysql-bin.000006 |    87795 |              |                  | 400f2c2b-e2bb-11ee-8f85-00505686c1d1:1-136 |
+------------------+----------+--------------+------------------+--------------------------------------------+

2、主库100.66.100.64执行操作如下

# 主库设置执行新主库复制链路,转为新从库,完成主从切换(注意:此处的MASTER_LOG_FILE='mysql-bin.000006'中mysql-bin.000006为上一步骤在原来的从节点查询到的结果)mysql> CHANGE MASTER TO-> master_host='100.66.101.5',-> MASTER_USER='repl',-> master_password='Nucleus!',-> MASTER_LOG_FILE='mysql-bin.000006',        -> MASTER_LOG_POS=1;
Query OK, 0 rows affected, 7 warnings (0.01 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: 100.66.101.5Master_User: replMaster_Port: 3306Connect_Retry: 60Master_Log_File: mysql-bin.000006Read_Master_Log_Pos: 87795Relay_Log_File: localhost-relay-bin.000002Relay_Log_Pos: 371Relay_Master_Log_File: mysql-bin.000006Slave_IO_Running: Yes     #此处必须为yes代表成功Slave_SQL_Running: Yes     #此处必须为yes代表成功Replicate_Do_DB:Replicate_Ignore_DB:Replicate_Do_Table:Replicate_Ignore_Table:Replicate_Wild_Do_Table:Replicate_Wild_Ignore_Table:Last_Errno: 0
............................................................省略

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

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

相关文章

【ITK配准】第七期 尺度(Metric)-直方图均方Metric

很高兴在雪易的CSDN遇见你 VTK技术爱好者 QQ:870202403 公众号:VTK忠粉 前言 本文分享ITK中的直方图均方Metric,即itk::MeanSquaresHistogramImageToImageMetric,希望对各位小伙伴有所帮助! 感谢各位小伙伴的点赞+关注,小易会继续努力分享,一起进步! 你的点赞…

Webshell绕过技巧分析之-base64/HEX/Reverse/Html/Inflate/Rot13

在网络安全运营,护网HVV,重保等活动的过程中,webshell是一个无法绕过的话题。通常出现的webshell都不是以明文的形式出现,而是针对webshell关键的内容进行混淆,编码来绕过网络安全产品(IDS,WAF&…

YOLO系列自研改进:基于注意力机制的多尺度特征提取模块

目录 一、原理 二、代码 三、在YOLO中的应用 一、原理 这个模块的原理仍然是利用不同大小的卷积核来提取不同尺度的特征,同样将通道划分为两部分,一部分通过注意力机制进行通道信息和空间信息的提取,另一部分通过多个不同大小的卷积核来提取多尺度的特征信息。 二、代码…

Baidu Comate——AI时代的软件开发利器

目录 Comate产品介绍 1.产品背景 ​编辑 2.产品优势 3.产品特性 4. 支持开发环境及语言 5.使用场景 Comate产品体验 Comate场景应用 2.快捷键的使用 专业插件体验 1.行间注释 2. 代码优化 3.解释说明代码 4.调优建议 5.AutoWork Comate实测体验感受 Comate产品介绍…

基于libmpv二次开发 使用函数整理

setlocale(LC_NUMERIC, "C");//必需要有,不然编译不过 mpv_handle *mpv mpv_create();//创建实例 WId widui->video->winId(); mpv_set_option(mpv,"wid",MPV_FORMAT_INT64,&wid);//设置播放器在哪个控件上显示 // Enable def…

Java 8特性(一) 之 手写Stream流filter、map和forEach方法

Java 8特性(一) 之 手写Stream流filter、map和forEach方法 今天看了一下Java 8的Stream流,学习了一下函数式编程,这才感受函数式编程如此爽,之前就使用过ES8.7.1的函数式编程,当时就在想啥时候咱也能写出这…

【日常运维】pm2起的应用删除应用日志后,发现磁盘控间没有释放,lsof | grep delete 也没看到相关进程,怎么办?

本站以分享各种运维经验和运维所需要的技能为主 《python零基础入门》:python零基础入门学习 《python运维脚本》: python运维脚本实践 《shell》:shell学习 《terraform》持续更新中:terraform_Aws学习零基础入门到最佳实战 《k8…

三维dp,LeetCode 1463. 摘樱桃 II

目录 一、题目 1、题目描述 2、接口描述 python3 cpp 3、原题链接 二、解题报告 1、思路分析 2、复杂度 3、代码详解 python3 cpp 一、题目 1、题目描述 给你一个 rows x cols 的矩阵 grid 来表示一块樱桃地。 grid 中每个格子的数字表示你能获得的樱桃数目。 你有…

FastJson==xml与json格式互转工具类

一、xml格式介绍 XML(eXtensible Markup Language)是一种标记语言,它的设计目的是为了存储和传输数据,而不是用于显示数据,这一点与HTML(HyperText Markup Language)不同。以下是XML的一些关键…

流畅的python-学习笔记_协议+继承优缺点

接口和协议 python动态语言,没有interface等概念,接口和协议方法有的也有替代品,所以类似于鸭子类型,只关注行为像鸭子,不关注它是不是鸭子。不是每个接口都得实现,这是允许的 猴子补丁 可动态给对象添加…

Java的BIO/NIO/AIO

1. Java中的BIO、NIO和AIO的基本概念及其主要区别 BIO (Blocking I/O): 传统的同步阻塞I/O模型。每个连接创建成功后都需要一个线程来处理,如果连接没有数据可读,则线程会阻塞在读操作上。这种模型简单易理解,但在高并发环境下会消耗大量系统…

ORACLE 19C RAC DIAG进程消耗大量内存的分析

近期一个ORACLE 19C的RAC环境,多次出现数据库实例的后台进程DIAG消耗很多内存(达到20G),节点1、节点2都出现过次问题。 问题分析:通过对DIAG进程TRACE分析,结合在ORACLE官方后台进行问题、BUG查询匹配&…

【ITK配准】第七期 尺度(Metric)-Kullback-Leiber距离Metric

很高兴在雪易的CSDN遇见你 VTK技术爱好者 QQ:870202403 公众号:VTK忠粉 前言 本文分享ITK中的互信息Metric,即itk::KullbackLeiblerCompareHistogramImageToImageMetric,希望对各位小伙伴有所帮助! 感谢各位小伙伴的点赞+关注,小易会继续努力分享,一起进步! …

全局测试用例环境和访问共享资源的GoogleTest教程

全局测试用例环境和访问共享资源的GoogleTest教程 介绍 在软件开发中,测试是确保软件质量的关键步骤之一。GoogleTest是一个流行的C测试框架,它提供了丰富的功能来编写和运行测试用例。在实际的软件项目中,有时需要在测试用例之间共享一些资…

思腾合力受邀参加VALSE 2024视觉与学习青年学者研讨会

在充满学术氛围的五月,思腾合力荣幸受邀参加了于2024年5月5-7日在重庆举行的第十四届VALSE大会。作为视觉与学习领域的顶级交流平台,VALSE大会每年都吸引着全国专家与学者的目光。 本次大会不仅延续了往届的高水平学术研讨,还进一步拓宽了研究…

台湾精锐APEX行星减速机噪音产生及优化策略

台湾精锐APEX行星减速机在各种机械装置中的应用逐渐广泛。然而,其噪音问题也日益凸显。噪音不仅影响工作环境,还可能对设备的正常运行和使用寿命产生负面影响。因此,了解APEX行星减速机噪音的产生以及优化噪音问题变得至关重要。 APEX行星减…

安卓自动化脚本制作流程详解!

在移动应用日益普及的今天,安卓自动化脚本制作成为了开发者提高工作效率、减少重复劳动的重要手段,本文将详细介绍安卓自动化脚本的制作流程,并通过五段源代码的实例,帮助读者更好地理解和掌握这一过程。 一、安卓自动化脚本制作…

从U盘到云端:企业数据泄露的那些事

在企业的日常运营中,数据安全无疑是极为关键的一环。无论是U盘还是云,数据泄露事件的发生都可能导致企业的核心机密被窃取,甚至损害企业的商业利益和声誉。以下是关于从U盘到云端,企业数据泄露的一些常见情况和应对策略。 U盘&…

各种流量包特征

[CVE-2013-1966] Apache Struts2 远程命令执行漏洞 要执行的命令在exec里面,而且回显数据包里面有明显执行结果回显 [CVE-2017-8046] Spring Data Rest 远程命令执行漏洞 回显不明显,考试提供的解码工具不能解密, [CVE-2017-12149] JBOSS…

Kibana初始化启动失败原因及解决办法

一) Unable to retrieve version information from Elasticsearch nodes 报错日志: 折叠源码 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 [rootnode1 bin]# ./kibana --allow-root log [16:03:07.086] [info][plugins-service] Plugin &…