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

中间件:maxwell、canal

文章目录

  • 1、底层原理:基于mysql的bin log日志实现的:把自己伪装成slave
  • 2、bin log 日志有三种模式:
    • 2.1、statement模式:
    • 2.2、row模式:
    • 2.3、mixed模式:
  • 3、maxwell只支持 row 模式:
  • 4、maxwell介绍
  • 5、maxwell入门
  • 6、拉取maxwell镜像命令如下
  • 7、配置数据库mysql
    • 7.1、在/var/lib/docker/volumes/mysql_conf/_data目录下创建 my.cnf
    • 7.2、查看 my.cnf
    • 7.3、编辑 my.cnf
    • 7.4、mysql 中创建 maxwell 用户
      • 7.4.1、在 docker 中连接 mysql
      • 7.4.2、创建 maxwell 用户
      • 7.4.3、授权用户maxwell从任何主机(%代表任何主机)连接到MySQL服务器,并对名为maxwell的数据库拥有所有权限(ALL)
      • 7.4.4、授权用户maxwell从任何主机(%代表任何主机)连接到MySQL服务器,并赋予它三个特定的权限:SELECT、REPLICATION CLIENT和REPLICATION SLAVE
  • 8、重启 mysql
  • 9、启动一个名为 zendesk/maxwell 的 Docker 容器,并配置 Maxwell 以监听 MySQL 数据库的变化并将这些变化输出到标准输出(stdout)
  • 10、修改 tingshu_album 数据库
  • 11、Maxwell正常关闭所有任务

1、底层原理:基于mysql的bin log日志实现的:把自己伪装成slave

在这里插入图片描述

  1. 所有的写操作到master主机,master会记录数据变化到 bin log 日志
  2. slave会通过 IO 线程 通过slave用户和master建立链接,并拉取bin log 日志的内容记录到自己的 relay log 中
  3. slave通过sql 线程 读取 relay log 中的内容进行 replay 重演重做,进而完成数据同步

2、bin log 日志有三种模式:

2.1、statement模式:

把 sql 语句记录到 bin log 日志。问题:当sql中有系统函数时,就会出现数据不一致。

2.2、row模式:

把变化后的数据记录到 bin log 日志。解决数据不一致问题,问题:批量操作时,使日志很大。

2.3、mixed模式:

智能选择适合的模式记录到 bin log 日志。当有系统函数时会自动选择row模式,当有批量操作时自动选择statement模式(推荐)。

3、maxwell只支持 row 模式:

会通过row模式获取 bin log 修改后的数据转化成 json 输出

4、maxwell介绍

maxwell的github地址:https://github.com/zendesk/maxwell

在这里插入图片描述
maxwells官网:https://maxwells-daemon.io/
在这里插入图片描述
Quick Start - Maxwell’s Daemon:https://maxwells-daemon.io/quickstart/

在这里插入图片描述

5、maxwell入门

在这里插入图片描述

6、拉取maxwell镜像命令如下

[root@localhost docker]# docker pull zendesk/maxwell
Using default tag: latest
latest: Pulling from zendesk/maxwell
1efc276f4ff9: Pull complete 
a2f2f93da482: Pull complete 
12cca292b13c: Pull complete 
69e15dccd787: Pull complete 
79219af6aa7c: Pull complete 
f39f1bdf1c84: Pull complete 
3261018f1785: Pull complete 
4f4fb700ef54: Pull complete 
be1353da9f00: Pull complete 
627d862c87f8: Pull complete 
Digest: sha256:68d51e27b6de2315ea710c0fe88972d4bd246ffb2519c82a49aa90a980d6cf64
Status: Downloaded newer image for zendesk/maxwell:latest
docker.io/zendesk/maxwell:latest

7、配置数据库mysql

在这里插入图片描述

# /etc/my.cnf[mysqld]
# maxwell needs binlog_format=row
binlog_format=row
server_id=1 
log-bin=master
[root@localhost etc]# docker inspect spzx-mysql
        "Mounts": [{"Type": "volume","Name": "mysql_data","Source": "/var/lib/docker/volumes/mysql_data/_data","Destination": "/var/lib/mysql","Driver": "local","Mode": "z","RW": true,"Propagation": ""},{"Type": "volume","Name": "mysql_conf","Source": "/var/lib/docker/volumes/mysql_conf/_data","Destination": "/etc/mysql","Driver": "local","Mode": "z","RW": true,"Propagation": ""}],
/var/lib/docker/volumes/mysql_conf/_data

7.1、在/var/lib/docker/volumes/mysql_conf/_data目录下创建 my.cnf

[root@localhost ~]# cd /var/lib/docker/volumes/mysql_conf/_data
[root@localhost _data]# ll
总用量 8
drwxrwxr-x. 2 root root   41 1226 2023 conf.d
-rw-rw-r--. 1 root root 1543 913 17:35 my.cnf
-rw-r--r--. 1 root root 1448 928 2021 my.cnf.fallback

此时发现已经有文件 my.cnf,这个文件是我在搭建mysql主从复制时创建的。

7.2、查看 my.cnf

[root@localhost _data]# cat my.cnf
# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA#
# The MySQL  Server configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html[mysqld]
# 服务器唯一id,默认值1
server-id=1
# # 设置日志格式,默认值ROW。row(记录行数据)  statement(记录sql)  mixed(混合模式)
binlog_format=STATEMENT
# # 二进制日志名,默认binlog
# # log-bin=binlog
log-bin=spzxbinlog
# # 设置需要复制的数据库,默认复制全部数据库
binlog-do-db=mydb2
binlog-do-db=mydb3
# # 设置不需要复制的数据库
binlog-ignore-db=mydb4
# #binlog-ignore-db=infomation_schema
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
datadir         = /var/lib/mysql
secure-file-priv= NULL# Custom config should go here
!includedir /etc/mysql/conf.d/

7.3、编辑 my.cnf

[mysqld]
# 服务器唯一id,默认值1
server-id=1
# # 设置日志格式,默认值ROW。row(记录行数据)  statement(记录sql)  mixed(混合模式)
binlog_format=row
# # 二进制日志名,默认binlog
# # log-bin=binlog
log-bin=spzxbinlog
# # 设置需要复制的数据库,默认复制全部数据库
binlog-do-db=mydb2
binlog-do-db=mydb3
binlog-do-db=tingshu_album
# # 设置不需要复制的数据库
binlog-ignore-db=mydb4
binlog-ignore-db=mysql
binlog-ignore-db=sys
binlog-ignore-db=performance_schema
binlog-ignore-db=information_schema
# #binlog-ignore-db=infomation_schema
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
datadir         = /var/lib/mysql
secure-file-priv= NULL# Custom config should go here
!includedir /etc/mysql/conf.d/

7.4、mysql 中创建 maxwell 用户

mysql> CREATE USER 'maxwell'@'%' IDENTIFIED BY 'XXXXXX';
mysql> CREATE USER 'maxwell'@'localhost' IDENTIFIED BY 'XXXXXX';mysql> GRANT ALL ON maxwell.* TO 'maxwell'@'%';
mysql> GRANT ALL ON maxwell.* TO 'maxwell'@'localhost';mysql> GRANT SELECT, REPLICATION CLIENT, REPLICATION SLAVE ON *.* TO 'maxwell'@'%';
mysql> GRANT SELECT, REPLICATION CLIENT, REPLICATION SLAVE ON *.* TO 'maxwell'@'localhost';

7.4.1、在 docker 中连接 mysql

[root@localhost _data]# docker exec -it spzx-mysql /bin/bash
root@ab66508d9441:/# mysql -uroot -p123456
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 8
Server version: 8.0.27 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.

7.4.2、创建 maxwell 用户

mysql> CREATE USER 'maxwell'@'%' IDENTIFIED BY 'maxwell';
Query OK, 0 rows affected (0.11 sec)

7.4.3、授权用户maxwell从任何主机(%代表任何主机)连接到MySQL服务器,并对名为maxwell的数据库拥有所有权限(ALL)

mysql> GRANT ALL ON maxwell.* TO 'maxwell'@'%';
Query OK, 0 rows affected (0.01 sec)

7.4.4、授权用户maxwell从任何主机(%代表任何主机)连接到MySQL服务器,并赋予它三个特定的权限:SELECT、REPLICATION CLIENT和REPLICATION SLAVE

mysql> GRANT SELECT, REPLICATION CLIENT, REPLICATION SLAVE ON *.* TO 'maxwell'@'%';
Query OK, 0 rows affected (0.01 sec)

8、重启 mysql

[root@localhost _data]# docker restart spzx-mysql 
spzx-mysql

9、启动一个名为 zendesk/maxwell 的 Docker 容器,并配置 Maxwell 以监听 MySQL 数据库的变化并将这些变化输出到标准输出(stdout)

在这里插入图片描述

docker run -it --rm zendesk/maxwell bin/maxwell --user=$MYSQL_USERNAME \--password=$MYSQL_PASSWORD --host=$MYSQL_HOST --producer=stdout
docker run -it --rm zendesk/maxwell bin/maxwell --user=maxwell \--password=maxwell --host=192.168.74.148 --port=3306 --producer=stdout
[root@localhost _data]# docker run -it --rm zendesk/maxwell bin/maxwell --user=maxwell \
>     --password=maxwell --host=192.168.74.148 --port=3306 --producer=stdout
2024-09-19 09:08:15 INFO  Maxwell - Starting Maxwell. maxMemory: 1031798784 bufferMemoryUsage: 0.25
2024-09-19 09:08:15 INFO  SchemaStoreSchema - Creating maxwell database
2024-09-19 09:08:15 INFO  Maxwell - Maxwell v1.41.2 is booting (StdoutProducer), starting at Position[BinlogPosition[spzxbinlog.000003:156], lastHeartbeat=0]
2024-09-19 09:08:16 INFO  AbstractSchemaStore - Maxwell is capturing initial schema
2024-09-19 09:08:17 INFO  BinlogConnectorReplicator - Setting initial binlog pos to: spzxbinlog.000003:156
2024-09-19 09:08:17 INFO  BinaryLogClient - Connected to 192.168.74.148:3306 at spzxbinlog.000003/156 (sid:6379, cid:23)
2024-09-19 09:08:17 INFO  BinlogConnectorReplicator - Binlog connected.
2024-09-19 09:08:15 INFO  SchemaStoreSchema - Creating maxwell database

在这里插入图片描述

10、修改 tingshu_album 数据库

在这里插入图片描述
在这里插入图片描述

[root@localhost _data]# docker run -it --rm zendesk/maxwell bin/maxwell --user=maxwell \
>     --password=maxwell --host=192.168.74.148 --port=3306 --producer=stdout
2024-09-19 09:08:15 INFO  Maxwell - Starting Maxwell. maxMemory: 1031798784 bufferMemoryUsage: 0.25
2024-09-19 09:08:15 INFO  SchemaStoreSchema - Creating maxwell database
2024-09-19 09:08:15 INFO  Maxwell - Maxwell v1.41.2 is booting (StdoutProducer), starting at Position[BinlogPosition[spzxbinlog.000003:156], lastHeartbeat=0]
2024-09-19 09:08:16 INFO  AbstractSchemaStore - Maxwell is capturing initial schema
2024-09-19 09:08:17 INFO  BinlogConnectorReplicator - Setting initial binlog pos to: spzxbinlog.000003:156
2024-09-19 09:08:17 INFO  BinaryLogClient - Connected to 192.168.74.148:3306 at spzxbinlog.000003/156 (sid:6379, cid:23)
2024-09-19 09:08:17 INFO  BinlogConnectorReplicator - Binlog connected.
{"database":"tingshu_album","table":"album_info","type":"update","ts":1726737222,"xid":1315,"commit":true,"data":{"id":1,"user_id":1,"album_title":"《夜色钢琴曲》maxwell","category3_id":1018,"album_intro":"《夜色钢琴曲》最新专辑上线啦 我的新专辑《夜色钢琴曲 最新专辑》(点击跳转)已经上线,新专辑是《夜...","cover_url":"https://imagev2.xmcdn.com/storages/b3d2-audiofreehighqps/91/8E/GMCoOSAFquG2AAU4zwEKNohZ.png","include_track_count":54,"is_finished":"0","estimated_track_count":164,"album_rich_intro":"<p data-flag=\"normal\" style=\"line-height:30px;font-family:Helvetica, Arial, sans-serif;\"><strong style=\"color: rgb(252, 88, 50); word-break: break-all; font-family: Helvetica, Arial, sans-serif; font-weight: normal;\"><span data-flag=\"tag\" style=\"padding:5px;margin:10px 0px;color:rgb(255, 255, 255);display:inline-block;\">《夜色钢琴曲》最新专辑上线啦</span> </strong></p><p style=\"color:#333333;font-weight:normal;font-size:16px;line-height:30px;font-family:Helvetica,Arial,sans-serif;hyphens:auto;text-align:left;\" lang=\"en\" data-flag=\"normal\">我的新专辑<a href=\"https://www.ximalaya.com/yinyue/35219974/\" style=\"color:#4990E2;text-decoration:none;\"><b>《夜色钢琴曲 最新专辑》</b></a>(点击跳转)已经上线,新专辑是《夜色钢琴曲》的升级版,我精选了诸多经典原创作品与大家分享,愿未来的每一个夜晚,大家在钢琴曲的陪伴下,能够卸下身体的浮躁与焦虑,内心不再孤单与慌张。</p><span><br /></span><p data-flag=\"normal\" style=\"line-height:30px;font-family:Helvetica, Arial, sans-serif;text-align:justify;\"><strong style=\"color: rgb(252, 88, 50); word-break: break-all; font-family: Helvetica, Arial, sans-serif; font-weight: normal;\"><span data-flag=\"strong\" style=\"word-break:break-all;\">赵海洋出生于1988年3月31日,专业的钢琴、作曲、编曲、钢琴教师、作品轻盈舒畅,委婉通透,曲曲经典,让人沐在他的音乐月光下,洗涤凡尘心垢。相关曲谱高清音乐某宝搜索:8919005,微博:夜色钢琴赵海洋</span></strong></p><p data-flag=\"normal\" style=\"font-size:16px;line-height:30px;font-family:Helvetica, Arial, sans-serif;color:rgb(51, 51, 51);font-weight:normal;text-align:left;\" lang=\"en\"><strong style=\"color: rgb(252, 88, 50); word-break: break-all; font-family: Helvetica, Arial, sans-serif; font-weight: normal;\"><img data-key=\"0\" src=\"http://fdfs.xmcdn.com/group28/M05/5E/06/wKgJXFknzliyDqDtAAMkXHYILXQ333_mobile_large.jpg\" alt=\"\" data-origin=\"http://fdfs.xmcdn.com/group28/M05/5E/06/wKgJXFknzliyDqDtAAMkXHYILXQ333.jpg\" data-large=\"http://fdfs.xmcdn.com/group28/M05/5E/06/wKgJXFknzliyDqDtAAMkXHYILXQ333_mobile_large.jpg\" data-large-width=\"750\" data-large-height=\"500\" data-preview=\"http://fdfs.xmcdn.com/group28/M05/5E/06/wKgJXFknzliyDqDtAAMkXHYILXQ333_mobile_small.jpg\" data-preview-width=\"140\" data-preview-height=\"93\" /><br /><br /></strong></p>","quality_score":0.00,"pay_type":"0101","price_type":"0201","price":0.00,"discount":-1.0,"vip_discount":-1.0,"tracks_for_free":0,"seconds_for_free":0,"buy_notes":null,"selling_point":null,"is_open":"1","status":"0301","create_time":"2023-04-04 09:05:02","update_time":"2024-09-19 09:13:42","is_deleted":1},"old":{"album_title":"《夜色钢琴曲》1","update_time":"2024-04-24 11:18:48"}}

在这里插入图片描述

{"database": "tingshu_album","table": "album_info","type": "update","ts": 1726737222,"xid": 1315,"commit": true,"data": {"id": 1,"user_id": 1,"album_title": "《夜色钢琴曲》maxwell","category3_id": 1018,"album_intro": "《夜色钢琴曲》最新专辑上线啦 我的新专辑《夜色钢琴曲 最新专辑》(点击跳转)已经上线,新专辑是《夜...","cover_url": "https://imagev2.xmcdn.com/storages/b3d2-audiofreehighqps/91/8E/GMCoOSAFquG2AAU4zwEKNohZ.png","include_track_count": 54,"is_finished": "0","estimated_track_count": 164,"album_rich_intro": "<p data-flag=\"normal\" style=\"line-height:30px;font-family:Helvetica, Arial, sans-serif;\"><strong style=\"color: rgb(252, 88, 50); word-break: break-all; font-family: Helvetica, Arial, sans-serif; font-weight: normal;\"><span data-flag=\"tag\" style=\"padding:5px;margin:10px 0px;color:rgb(255, 255, 255);display:inline-block;\">《夜色钢琴曲》最新专辑上线啦</span> </strong></p><p style=\"color:#333333;font-weight:normal;font-size:16px;line-height:30px;font-family:Helvetica,Arial,sans-serif;hyphens:auto;text-align:left;\" lang=\"en\" data-flag=\"normal\">我的新专辑<a href=\"https://www.ximalaya.com/yinyue/35219974/\" style=\"color:#4990E2;text-decoration:none;\"><b>《夜色钢琴曲 最新专辑》</b></a>(点击跳转)已经上线,新专辑是《夜色钢琴曲》的升级版,我精选了诸多经典原创作品与大家分享,愿未来的每一个夜晚,大家在钢琴曲的陪伴下,能够卸下身体的浮躁与焦虑,内心不再孤单与慌张。</p><span><br /></span><p data-flag=\"normal\" style=\"line-height:30px;font-family:Helvetica, Arial, sans-serif;text-align:justify;\"><strong style=\"color: rgb(252, 88, 50); word-break: break-all; font-family: Helvetica, Arial, sans-serif; font-weight: normal;\"><span data-flag=\"strong\" style=\"word-break:break-all;\">赵海洋出生于1988年3月31日,专业的钢琴、作曲、编曲、钢琴教师、作品轻盈舒畅,委婉通透,曲曲经典,让人沐在他的音乐月光下,洗涤凡尘心垢。相关曲谱高清音乐某宝搜索:8919005,微博:夜色钢琴赵海洋</span></strong></p><p data-flag=\"normal\" style=\"font-size:16px;line-height:30px;font-family:Helvetica, Arial, sans-serif;color:rgb(51, 51, 51);font-weight:normal;text-align:left;\" lang=\"en\"><strong style=\"color: rgb(252, 88, 50); word-break: break-all; font-family: Helvetica, Arial, sans-serif; font-weight: normal;\"><img data-key=\"0\" src=\"http://fdfs.xmcdn.com/group28/M05/5E/06/wKgJXFknzliyDqDtAAMkXHYILXQ333_mobile_large.jpg\" alt=\"\" data-origin=\"http://fdfs.xmcdn.com/group28/M05/5E/06/wKgJXFknzliyDqDtAAMkXHYILXQ333.jpg\" data-large=\"http://fdfs.xmcdn.com/group28/M05/5E/06/wKgJXFknzliyDqDtAAMkXHYILXQ333_mobile_large.jpg\" data-large-width=\"750\" data-large-height=\"500\" data-preview=\"http://fdfs.xmcdn.com/group28/M05/5E/06/wKgJXFknzliyDqDtAAMkXHYILXQ333_mobile_small.jpg\" data-preview-width=\"140\" data-preview-height=\"93\" /><br /><br /></strong></p>","quality_score": 0,"pay_type": "0101","price_type": "0201","price": 0,"discount": -1,"vip_discount": -1,"tracks_for_free": 0,"seconds_for_free": 0,"buy_notes": null,"selling_point": null,"is_open": "1","status": "0301","create_time": "2023-04-04 09:05:02","update_time": "2024-09-19 09:13:42","is_deleted": 1},"old": {"album_title": "《夜色钢琴曲》1","update_time": "2024-04-24 11:18:48"}
}

11、Maxwell正常关闭所有任务

^C2024-09-19 09:31:56 INFO  MaxwellContext - Sending final heartbeat: 1726738316328
2024-09-19 09:32:01 WARN  MaxwellContext - Timed out waiting for heartbeat 1726738316328
2024-09-19 09:32:01 INFO  TaskManager - Stopping 3 tasks
2024-09-19 09:32:01 INFO  TaskManager - Stopping: com.zendesk.maxwell.schema.PositionStoreThread@7ff21fb0
2024-09-19 09:32:01 INFO  TaskManager - Stopping: com.zendesk.maxwell.bootstrap.BootstrapController@2ea6c604
2024-09-19 09:32:01 INFO  TaskManager - Stopping: com.zendesk.maxwell.replication.BinlogConnectorReplicator@24625899
2024-09-19 09:32:01 INFO  BinlogConnectorReplicator - Binlog disconnected.
2024-09-19 09:32:01 INFO  TaskManager - Stopped all tasks

相关文章:

中间件:maxwell、canal

文章目录 1、底层原理&#xff1a;基于mysql的bin log日志实现的&#xff1a;把自己伪装成slave2、bin log 日志有三种模式&#xff1a;2.1、statement模式&#xff1a;2.2、row模式&#xff1a;2.3、mixed模式&#xff1a; 3、maxwell只支持 row 模式&#xff1a;4、maxwell介…...

postman控制变量和常用方法

1、添加环境&#xff1a; 2、环境添加变量&#xff1a; 3、配置不同的环境&#xff1a;local、dev、sit、uat、pro 4、 接口调用 5、清除cookie方法&#xff1a; 6、下载文件方法&#xff1a;...

Spring Boot 中整合 Kafka

在 Spring Boot 中整合 Kafka 非常简单&#xff0c;Spring Kafka 提供了丰富的支持&#xff0c;使得我们可以轻松地实现 Kafka 的生产者和消费者。下面是一个简单的 Spring Boot 整合 Kafka 的示例。 1. 添加依赖 首先&#xff0c;在 pom.xml 中添加 Spring Kafka 的依赖&#…...

什么是开放式耳机?具有什么特色?非常值得入手的蓝牙耳机推荐

开放式耳机是当下较为热门的一种耳机类型。它具有以下特点&#xff1a; 设计结构&#xff1a; 呈现开放式的构造&#xff0c;不会完全堵住耳道。如此一来&#xff0c;外界声音能够较容易地被使用者听到&#xff0c;在使用耳机时可以保持对周围环境的察觉。比如在户外&#xf…...

编译 FFmpeg 以支持 AV1 编解码器以及其他硬件加速选项(如 NVENC、VAAPI 等)

步骤 1: 安装必要的依赖 sudo apt update sudo apt install -y \autoconf automake build-essential cmake git libass-dev libfreetype6-dev \libsdl2-dev libtool libva-dev libvdpau-dev libxcb1-dev libxcb-shm0-dev \libxcb-xfixes0-dev pkg-config texinfo wget zlib1g-…...

解释一下Java中的多线程。如何创建一个新的线程?

在Java中&#xff0c;多线程是一种机制&#xff0c;允许一个程序同时执行多个任务或处理。每个任务被称为一个线程。 这种并行执行可以极大地提高应用程序的效率和响应速度。 例如&#xff0c;在开发一个桌面应用程序时&#xff0c;你可以使用一个线程来更新用户界面&#xf…...

Java语言程序设计基础篇_编程练习题**18.30 (找出单词)

题目&#xff1a;**18.30 (找出单词) 编写一个程序&#xff0c;递归地找出某个目录下的所有文件中某个单词出现的次数。从命令行如下传递参数&#xff1a; java Exercise18_30 dirName word 习题思路 &#xff08;读取路径方法&#xff09;和18.28题差不多&#xff0c;把找…...

MyBatis中 #{} 和 ${} 的区别

1. #{id}&#xff08;参数占位符&#xff09; 作用: 使用 #{id} 时&#xff0c;MyBatis 会将 id 参数绑定为 JDBC 的参数。这种方式能够有效防止 SQL 注入攻击&#xff0c;因为它会进行参数的预处理&#xff0c;将参数值作为数据类型的绑定&#xff0c;而不是直接插入到 SQL 语…...

Android Perfetto 学习

1、如何抓取性能日志 方式1、通过手机里的System Tracing抓取 1、点击Settings->System->Developer options->System Tracing->Record trace 打开 2、操作完成后&#xff0c;点击Settings->System->Developer options->System Tracing->Record trace…...

ES数据的删除与备份

背景 需要删除索引下满足指定条件的文档数据&#xff0c;并将删除的数据进行备份。 操作步骤 新建索引 该索引结构与映射关系与原索引一致 查看原索引设置 GET /tb/_settings结果&#xff1a; {"tb" : {"settings" : {"index" : {"ro…...

论文解读《Object-Centric Learning with Slot Attention》

系列文章目录 文章目录 系列文章目录论文细节理解 1. 研究背景2. 论文贡献3. 方法框架3.1 Slot Attention模块3.2 无监督对象发现架构 4. 研究思路5. 实验6. 限制 论文细节理解 supervised property prediction tasks是什么&#xff1f; Supervised property prediction tasks…...

YOLOv8+注意力机制+PyQt5玉米病害检测系统完整资源集合

资源包含可视化的玉米病害检测系统&#xff0c;基于最新的YOLOv8注意力机制训练的玉米病害检测模型&#xff0c;和基于PyQt5制作的可视玉米病害系统&#xff0c;包含登陆页面和检测页面&#xff0c;该系统可自动检测和识别图片或视频当中出现的七类玉米病害&#xff1a;矮花叶病…...

tcp、udp通信调试工具Socket Tool

tcp、udp通信调试工具Socket Tool ]...

MedPrompt:基于提示工程的医学诊断准确率优化方法

Medprompt&#xff1a;基于提示工程的医学诊断准确率优化方法 秒懂大纲解法拆解MedPrompt 提示词全流程分析总结创意视角 论文&#xff1a;Can Generalist Foundation Models Outcompete Special-Purpose Tuning? Case Study in Medicine 秒懂大纲 ├── 1 研究背景【描述背…...

关于ollama 在mac的部署问题

安装 官网链接 直接按需求下载即可 默认模型下载地址 macOS: ~/.ollama/models Linux: /usr/share/ollama/.ollama/models Windows: C:\Users<username>.ollama\models 根据需要的平台设置相应的环境变量&#xff1a; OLLAMA_MODELS 如Mac 设置 &#xff5e;/.zshrc …...

职业技能大赛-单元测试笔记(assertThat)分享

前言 assertThat 是一种用于编写测试断言的方法,广泛应用于 Java 及其他编程语言的测试框架中,如 JUnit 和 AssertJ。它特别强调可读性和流畅性,使得测试代码更加直观易懂,从而提高了开发者在编写和维护测试时的效率。传统的断言方法通常以较为简洁但不够清晰的形式出现,例…...

AI大模型:OpenAI o1或能成为引领AI Phenomenal Ride的LLM新范式

OpenAI 发布 o1 系列大模型&#xff0c;AI 大模型进入新纪元**。**9 月 12 日&#xff0c;OpenAI 宣布开发了一系列全新AI 模型&#xff0c;其被命名为 OpenAI o1-preview&#xff0c;旨在在回应前投入更多时间思考。与之前的模型相比&#xff0c;这些模型能够更好地进行推理&a…...

天命人,如何轻松利用仿真技术打造出属于你的“金箍棒”?

近期&#xff0c;一款以西游记为背景的国产游戏&#xff0c;‌重塑了悟空这一经典角色&#xff0c;‌将其置于一个黑暗、‌魔幻的世界中。同时也是国内第一款 3A 游戏大作&#xff0c;而所谓 3A 游戏&#xff0c;简单来说就是高质量&#xff0c;高体量&#xff0c;高成本的单机…...

【Qt | QAction】Qt 的 QAction 类介绍

&#x1f601;博客主页&#x1f601;&#xff1a;&#x1f680;https://blog.csdn.net/wkd_007&#x1f680; &#x1f911;博客内容&#x1f911;&#xff1a;&#x1f36d;嵌入式开发、Linux、C语言、C、数据结构、音视频&#x1f36d; &#x1f923;本文内容&#x1f923;&a…...

写论文一定要知道的三大AI工具!5分钟完成论文初稿

在当今的学术研究和写作领域&#xff0c;AI工具已经成为不可或缺的助手。它们不仅能够提高写作效率&#xff0c;还能帮助研究者生成高质量的论文。以下是三大值得推荐的AI工具&#xff0c;它们可以帮助你在5分钟内完成论文初稿&#xff0c;并且特别推荐千笔-AIPasspaper。 千笔…...

【网络】每天掌握一个Linux命令 - iftop

在Linux系统中&#xff0c;iftop是网络管理的得力助手&#xff0c;能实时监控网络流量、连接情况等&#xff0c;帮助排查网络异常。接下来从多方面详细介绍它。 目录 【网络】每天掌握一个Linux命令 - iftop工具概述安装方式核心功能基础用法进阶操作实战案例面试题场景生产场景…...

从零开始打造 OpenSTLinux 6.6 Yocto 系统(基于STM32CubeMX)(九)

设备树移植 和uboot设备树修改的内容同步到kernel将设备树stm32mp157d-stm32mp157daa1-mx.dts复制到内核源码目录下 源码修改及编译 修改arch/arm/boot/dts/st/Makefile&#xff0c;新增设备树编译 stm32mp157f-ev1-m4-examples.dtb \stm32mp157d-stm32mp157daa1-mx.dtb修改…...

【电力电子】基于STM32F103C8T6单片机双极性SPWM逆变(硬件篇)

本项目是基于 STM32F103C8T6 微控制器的 SPWM(正弦脉宽调制)电源模块,能够生成可调频率和幅值的正弦波交流电源输出。该项目适用于逆变器、UPS电源、变频器等应用场景。 供电电源 输入电压采集 上图为本设计的电源电路,图中 D1 为二极管, 其目的是防止正负极电源反接, …...

tomcat入门

1 tomcat 是什么 apache开发的web服务器可以为java web程序提供运行环境tomcat是一款高效&#xff0c;稳定&#xff0c;易于使用的web服务器tomcathttp服务器Servlet服务器 2 tomcat 目录介绍 -bin #存放tomcat的脚本 -conf #存放tomcat的配置文件 ---catalina.policy #to…...

如何应对敏捷转型中的团队阻力

应对敏捷转型中的团队阻力需要明确沟通敏捷转型目的、提升团队参与感、提供充分的培训与支持、逐步推进敏捷实践、建立清晰的奖励和反馈机制。其中&#xff0c;明确沟通敏捷转型目的尤为关键&#xff0c;团队成员只有清晰理解转型背后的原因和利益&#xff0c;才能降低对变化的…...

MyBatis中关于缓存的理解

MyBatis缓存 MyBatis系统当中默认定义两级缓存&#xff1a;一级缓存、二级缓存 默认情况下&#xff0c;只有一级缓存开启&#xff08;sqlSession级别的缓存&#xff09;二级缓存需要手动开启配置&#xff0c;需要局域namespace级别的缓存 一级缓存&#xff08;本地缓存&#…...

如何配置一个sql server使得其它用户可以通过excel odbc获取数据

要让其他用户通过 Excel 使用 ODBC 连接到 SQL Server 获取数据&#xff0c;你需要完成以下配置步骤&#xff1a; ✅ 一、在 SQL Server 端配置&#xff08;服务器设置&#xff09; 1. 启用 TCP/IP 协议 打开 “SQL Server 配置管理器”。导航到&#xff1a;SQL Server 网络配…...

何谓AI编程【02】AI编程官网以优雅草星云智控为例建设实践-完善顶部-建立各项子页-调整排版-优雅草卓伊凡

何谓AI编程【02】AI编程官网以优雅草星云智控为例建设实践-完善顶部-建立各项子页-调整排版-优雅草卓伊凡 背景 我们以建设星云智控官网来做AI编程实践&#xff0c;很多人以为AI已经强大到不需要程序员了&#xff0c;其实不是&#xff0c;AI更加需要程序员&#xff0c;普通人…...

6.9本日总结

一、英语 复习默写list11list18&#xff0c;订正07年第3篇阅读 二、数学 学习线代第一讲&#xff0c;写15讲课后题 三、408 学习计组第二章&#xff0c;写计组习题 四、总结 明天结束线代第一章和计组第二章 五、明日计划 英语&#xff1a;复习l默写sit12list17&#…...

中科院1区顶刊|IF14+:多组学MR联合单细胞时空分析,锁定心血管代谢疾病的免疫治疗新靶点

中科院1区顶刊|IF14&#xff1a;多组学MR联合单细胞时空分析&#xff0c;锁定心血管代谢疾病的免疫治疗新靶点 当下&#xff0c;免疫与代谢性疾病的关联研究已成为生命科学领域的前沿热点。随着研究的深入&#xff0c;我们愈发清晰地认识到免疫系统与代谢系统之间存在着极为复…...