当前位置: 首页 > 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。 千笔…...

苍穹外卖--缓存菜品

1.问题说明 用户端小程序展示的菜品数据都是通过查询数据库获得&#xff0c;如果用户端访问量比较大&#xff0c;数据库访问压力随之增大 2.实现思路 通过Redis来缓存菜品数据&#xff0c;减少数据库查询操作。 缓存逻辑分析&#xff1a; ①每个分类下的菜品保持一份缓存数据…...

【android bluetooth 框架分析 04】【bt-framework 层详解 1】【BluetoothProperties介绍】

1. BluetoothProperties介绍 libsysprop/srcs/android/sysprop/BluetoothProperties.sysprop BluetoothProperties.sysprop 是 Android AOSP 中的一种 系统属性定义文件&#xff08;System Property Definition File&#xff09;&#xff0c;用于声明和管理 Bluetooth 模块相…...

【服务器压力测试】本地PC电脑作为服务器运行时出现卡顿和资源紧张(Windows/Linux)

要让本地PC电脑作为服务器运行时出现卡顿和资源紧张的情况&#xff0c;可以通过以下几种方式模拟或触发&#xff1a; 1. 增加CPU负载 运行大量计算密集型任务&#xff0c;例如&#xff1a; 使用多线程循环执行复杂计算&#xff08;如数学运算、加密解密等&#xff09;。运行图…...

C++.OpenGL (14/64)多光源(Multiple Lights)

多光源(Multiple Lights) 多光源渲染技术概览 #mermaid-svg-3L5e5gGn76TNh7Lq {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-3L5e5gGn76TNh7Lq .error-icon{fill:#552222;}#mermaid-svg-3L5e5gGn76TNh7Lq .erro…...

华为OD机考-机房布局

import java.util.*;public class DemoTest5 {public static void main(String[] args) {Scanner in new Scanner(System.in);// 注意 hasNext 和 hasNextLine 的区别while (in.hasNextLine()) { // 注意 while 处理多个 caseSystem.out.println(solve(in.nextLine()));}}priv…...

Web后端基础(基础知识)

BS架构&#xff1a;Browser/Server&#xff0c;浏览器/服务器架构模式。客户端只需要浏览器&#xff0c;应用程序的逻辑和数据都存储在服务端。 优点&#xff1a;维护方便缺点&#xff1a;体验一般 CS架构&#xff1a;Client/Server&#xff0c;客户端/服务器架构模式。需要单独…...

tomcat指定使用的jdk版本

说明 有时候需要对tomcat配置指定的jdk版本号&#xff0c;此时&#xff0c;我们可以通过以下方式进行配置 设置方式 找到tomcat的bin目录中的setclasspath.bat。如果是linux系统则是setclasspath.sh set JAVA_HOMEC:\Program Files\Java\jdk8 set JRE_HOMEC:\Program Files…...

MFE(微前端) Module Federation:Webpack.config.js文件中每个属性的含义解释

以Module Federation 插件详为例&#xff0c;Webpack.config.js它可能的配置和含义如下&#xff1a; 前言 Module Federation 的Webpack.config.js核心配置包括&#xff1a; name filename&#xff08;定义应用标识&#xff09; remotes&#xff08;引用远程模块&#xff0…...

Neko虚拟浏览器远程协作方案:Docker+内网穿透技术部署实践

前言&#xff1a;本文将向开发者介绍一款创新性协作工具——Neko虚拟浏览器。在数字化协作场景中&#xff0c;跨地域的团队常需面对实时共享屏幕、协同编辑文档等需求。通过本指南&#xff0c;你将掌握在Ubuntu系统中使用容器化技术部署该工具的具体方案&#xff0c;并结合内网…...

车载诊断架构 --- ZEVonUDS(J1979-3)简介第一篇

我是穿拖鞋的汉子,魔都中坚持长期主义的汽车电子工程师。 老规矩,分享一段喜欢的文字,避免自己成为高知识低文化的工程师: 做到欲望极简,了解自己的真实欲望,不受外在潮流的影响,不盲从,不跟风。把自己的精力全部用在自己。一是去掉多余,凡事找规律,基础是诚信;二是…...