mysql配置文件:
1、修改文件 /etc/mysql/my.cnf:
server_id=1 ###代表集群模式第一台机器
binlog_format=ROW ###行模式
log_bin=mysql_bin ###binlog的文件名称
2、重启mysql容器并进入容器,查看mysql是否开启binlog:
show variables like 'log_bin';
show variables like 'binlog_format';
创建canle的账户(使用root账户也是可以的)
CREATE USER canal IDENTIFIED BY 'canal';
GRANT SELECT, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'canal'@'%';
/GRANT ALL PRIVILEGES ON *.* TO 'canal'@'%' ;
FLUSH PRIVILEGES;
配置canal:
下载canal,这里使用的windows版本:
链接:https://pan.baidu.com/s/1O7m95qhlcl9FUVT0_w0PaQ
提取码:6666
1、解压后进入conf\example文件,打开instance.properties配置文件:
2、bin文件夹下启动start.bat
正常启动:
log/canal/canal.log
遇到的问题:
A. 闪退 无日志文件,点击restart.sh后日志文件canal_stdout.log:
Error: missing
server' JVM at
C:\Program Files (x86)\Java\jre1.8.0_73\bin\server\jvm.dll’. Please install or use the
JRE or JDK that contains these missing components.
解决方案:
把jdk下面的jre里的server文件夹,移到jre的bin下
B.启动报错:
Unexpected filename extension of file [file:/D:/canal_1.1.4/conf/]. Should be either .groovy or .xml
解决方案:
将bin文件夹中的startup.bat中的 -Dlogback.configurationFile="%logback_configurationFile%” 删掉