网站首页 > 博客文章 正文
Debezium是一个开源的CDC (Change Data Capture)工具,用来实时监控数据库中的变化,生成事件流、存入Kafka。
Debezium支持多种主流数据库,MySQL是其中一种。使用该工具时,我们需要在MySQL端进行哪些设置呢?官方文档中对此语焉不详。好在文档中的Tutorial给我们提供了一些线索。Tutorial中所使用的MySQL单机版Docker Image,其构建文件在这儿:https://github.com/debezium/container-images/tree/main/examples/mysql/2.0。一共有三个文件:Dockerfile、inventory.sql、及mysql.cnf。
分析Dockerfile可知,inventory.sql是用来生成Tutorial所用的表、和数据,而mysql.cnf即为Debezium所需的特殊配置。
然而,从Dockerfile还可看出,该镜像的基础镜像是MySQL的官方镜像。而MySQL官方镜像中的参数配置可在这儿查到:https://github.com/docker-library/mysql/tree/master/8.0/config。
剔除两边重复的部分、及Debezium中过时的参数,可精简Debezium Tutorial中的mysql.cnf如下:
[mysqld]
user=mysql
# ----------------------------------------------
# Enable the binlog for replication & CDC
# ----------------------------------------------
# Enable binary replication log and set the prefix, expiration, and log format.
# The prefix is arbitrary, expiration can be short for integration tests but would
# be longer on a production system. Row-level info is required for ingest to work.
# Server ID is required, but this will vary on production systems
server-id = 223344
log_bin = mysql-bin
expire_logs_days = 1
binlog_format = row
# For Debezium MySQL connector
default_authentication_plugin = mysql_native_password
在这当中,user=mysql只是设置MySQL以非root用户运行,与Debezium无关。因此,有关的只有两部分,一部分是设置MySQL binlog,这是Debezium捕捉数据的地方;另一部分为设置default authentication plugin,其缺省值是caching_sha2_password,为了Debezium MySQL connector,需改为mysql_native_password。
按上述修改重新构建Docker Image,并将Debezium Tutorial中的quay.io/debezium/example-mysql替换为biandayu/example-mysql,Debezium工作正常。
猜你喜欢
- 2024-09-10 解决Navicat连接 Mysql 8 出现1251- Client does not support错误
- 2024-09-10 win10安装mysql遇到的坑(win10安装mysql5.5)
- 2024-09-10 MySQL系列-二进制包安装(v8.0.24)
- 2024-09-10 Win10+docker+Laradock(下篇):Docker的基本操作与项目开发配置
- 2024-09-10 Java 连接 MySQL 8.0 排错案例-爱可生
- 2024-09-10 MySQL数据库下载、安装、配置、卸载
- 2024-09-10 不要再原地踏步了,升级到 MySQL 8.x 的 6 大理由!
- 2024-09-10 Django + MySQL 8 开发环境用 Docker来部署
- 2024-09-10 【每日一学】数据库大揭秘:MySQL 事务学习手册,精通数据操作!
- 2024-09-10 MySQL性能基准测试对比:MySQL 5.7与MySQL 8.0
你 发表评论:
欢迎- 367℃用AI Agent治理微服务的复杂性问题|QCon
- 358℃初次使用IntelliJ IDEA新建Maven项目
- 356℃手把手教程「JavaWeb」优雅的SpringMvc+Mybatis整合之路
- 351℃Maven技术方案最全手册(mavena)
- 348℃安利Touch Bar 专属应用,让闲置的Touch Bar活跃起来!
- 346℃InfoQ 2024 年趋势报告:架构篇(infoq+2024+年趋势报告:架构篇分析)
- 345℃IntelliJ IDEA 2018版本和2022版本创建 Maven 项目对比
- 342℃从头搭建 IntelliJ IDEA 环境(intellij idea建包)
- 最近发表
- 标签列表
-
- powershellfor (55)
- messagesource (56)
- aspose.pdf破解版 (56)
- promise.race (63)
- 2019cad序列号和密钥激活码 (62)
- window.performance (66)
- qt删除文件夹 (72)
- mysqlcaching_sha2_password (64)
- ubuntu升级gcc (58)
- nacos启动失败 (64)
- ssh-add (70)
- jwt漏洞 (58)
- macos14下载 (58)
- yarnnode (62)
- abstractqueuedsynchronizer (64)
- source~/.bashrc没有那个文件或目录 (65)
- springboot整合activiti工作流 (70)
- jmeter插件下载 (61)
- 抓包分析 (60)
- idea创建mavenweb项目 (65)
- vue回到顶部 (57)
- qcombobox样式表 (68)
- vue数组concat (56)
- tomcatundertow (58)
- pastemac (61)
本文暂时没有评论,来添加一个吧(●'◡'●)