cancel框架同步mysql数据到kafka

1、下载cancel

复制代码
https://github.com/alibaba/canal/releases/tag/canal-1.1.5

2、修改conf文件夹下的canal.properties配置文件

复制代码
canal.zkServers=localhost:2181
canal.serverMode = kafka
##################################################
######### 		     Kafka 		     #############
##################################################
kafka.bootstrap.servers = localhost:9092

3、修改conf/example文件夹下的instance.properties配置文件

在sql查询show binary logs语句得到binlog日志

复制代码
canal.instance.master.address= localhost:3306
canal.instance.master.journal.name=mysql-bin.000001
canal.instance.master.position=156

# username/password
canal.instance.dbUsername=xxxx
canal.instance.dbPassword=xxxxx
canal.instance.filter.regex=db_mybatis.userProject #数据库名.表名,可多个
canal.mq.topic=canceltopic   #消息队列的topic

4、启动

在bin目录下执行

复制代码
./startup.sh

启动程序

注:MySQL需要创建新用户

复制代码
mysql> CREATE USER canal IDENTIFIED BY '123456'; 
mysql> GRANT SELECT, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'canal'@'%';  
mysql> FLUSH PRIVILEGES;
mysql> show grants for 'canal' ;
相关推荐
AC赳赳老秦2 分钟前
OpenClaw text-translate技能:多语言批量翻译,解决跨境工作沟通难题
大数据·运维·数据库·人工智能·python·deepseek·openclaw
AI应用实战 | RE17 分钟前
014、索引高级实战:当单一向量库不够用的时候
数据库·人工智能·langchain
ffqws_17 分钟前
Spring Boot入门:通过简单的注册功能串联Controller,Service,Mapper。(含有数据库建立,连接,及一些关键注解的讲解)
数据库·spring boot·后端
清水白石00829 分钟前
《Python 架构师的自动化哲学:从基础语法到企业级作业调度系统与 Airflow 止损实战》
数据库·python·自动化
阿华田51234 分钟前
MySQL性能优化大全
数据库·mysql·性能优化
kaico201841 分钟前
python操作数据库
开发语言·数据库·python
被摘下的星星41 分钟前
MySQL 别名使用规则详解
数据库·mysql
墨着染霜华1 小时前
MySQL 重复数据删除语句
数据库·mysql
ego.iblacat1 小时前
PostgreSQL 数据库
数据库·postgresql
wgzrmlrm741 小时前
如何解决ORA-28040没有匹配的验证协议_sqlnet.ora版本兼容设置
jvm·数据库·python