下载cancel
https://github.com/alibaba/canal/releases/tag/canal-1.1.5
修改conf文件夹下的canal.properties配置文件
canal.zkServers=localhost:2181canal.serverMode = kafka########################################################### Kafka ###############################################################kafka.bootstrap.servers = localhost:9092
修改conf/example文件夹下的instance.properties配置文件
在sql查询show binary logs语句得到binlog日志
canal.instance.master.address= localhost:3306canal.instance.master.journal.name=mysql-bin.000001canal.instance.master.position=156# username/passwordcanal.instance.dbUsername=xxxxcanal.instance.dbPassword=xxxxxcanal.instance.filter.regex=db_mybatis.userProject #数据库名.表名,可多个canal.mq.topic=canceltopic #消息队列的topic
启动
在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' ;
来源地址:https://blog.csdn.net/weixin_41463944/article/details/131779196