赞
踩
当前的 canal 支持源端 MySQL 版本包括 5.1.x , 5.5.x , 5.6.x , 5.7.x , 8.0.x
https://github.com/alibaba/canal#readme
修改配置文件并重启服务
log-bin=mysql-bin #开启 binlog
binlog-format=ROW #选择 ROW 模式
server_id=1 #配置MySQL replaction需要定义,不要和canal的 slaveId重复
执行SQL查询的value为ON
SHOW VARIABLES LIKE 'log_bin';
# GRANT system_user ON *.* TO 'root';
# flush privileges;
DROP USER IF EXISTS 'canal'@'%';
CREATE USER 'canal'@'%' IDENTIFIED BY 'canal';
GRANT ALL PRIVILEGES ON *.* TO 'canal'@'%' WITH GRANT OPTION;
# GRANT system_user ON *.* TO 'canal';
flush privileges;
https://github.com/alibaba/canal/releases/tag/canal-1.1.6
下载Linux版本:canal.deployer-1.1.6.tar.gz
解压
mkdir /mycanal
cp canal.deployer-1.1.6.tar.gz /mycanal/
cd /mycanal
tar -zxvf canal.deployer-1.1.6.tar.gz
vim conf/example/instance.properties
改数据库地址和登录数据库的用户名和密码(上一步设置的用户)
canal.instance.master.address=192.168.10.20:3306
canal.instance.tsdb.dbUsername=canal
canal.instance.tsdb.dbPassword=canal
启动
./bin/startup.sh
查看日志判断是否启动成功
cat logs/canal/canal.log
2023-06-28 10:39:17.122 [main] INFO com.alibaba.otter.canal.deployer.CanalStarter - ## the canal server is running now …
cat logs/example/example.log
2023-06-28 10:39:16.917 [main] INFO c.a.otter.canal.instance.core.AbstractCanal Instance - start successful…
官网示例https://github.com/alibaba/canal/wiki/ClientExample
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。