1.canal 前置条件 a.jdk 1.8+ b.python c.mvn 3.6+
2.源mysql 需要支持binlog 并且 binlog-format=ROW
[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# 打开binlog
log-bin=mysql-bin
# 选择ROW(行)模式
binlog-format=ROW
# 配置MySQL replaction需要定义,不要和canal的slaveId重复
server_id=1
expire_logs_days = 7
max_binlog_size=500M
3.canal 安装
[root@master1 canal]#wget https://github.com/alibaba/canal/releases/download/canal-1.1.5/canal.deployer-1.1.5.tar.gz
[root@master1 canal]#mkdir /root/canal
[root@master1 canal]#tar zxvf canal.deployer-1.1.5.tar.gz -C /root/canal
4.设置 conf/example/instance.properties
a.设置源数据库地址canal.instance.master.address
canal.instance.master.address=192.168.72.128:3306
b.设置连接源数据的用户名和密码
# username/password
canal.instance.dbUsername=canal
canal.instance.dbPassword=123456
c.设置需要监听的数据库和表,默认所有库所有表
# table regex
canal.instance.filter.regex=.*\\..*