First, the installation package download (canal.deployer-x.x.x.tar.gz official recommended to use the 1.0.22 version)
Https://github.com/alibaba/canal/releases
Second, unzip the file
TAR-ZXVF canal.deployer-1.0.22.tar.gz-c/app/canal/
Iii. modification of the canal configuration file
Vim $CANAL _home/conf/canal.properties
Vim $CANAL _home/conf/example/instance.properties
Description
CANAL.ZKSERVERS:ZK Address
Canal.instance.mysql.slaveId:mysql ServerID (cannot be the same as server_id in MySQL configuration)
Canal.instance.master.address: Database Address
Canal.instance.dbUsername:mysql User Name
Canal.instance.dbPassword: Password
Canal.instance.defaultDatabaseName: the default monitored database
Canal.instance.filter.regex: Filtered Regular expression (default full-Library full table)
Iv. Database Configuration
The database needs to turn on the Binlog log, and it is row mode
V. Start the Canal service (each machine starts, but only one server is available on ZK)
bin/startup.sh
Vi. updating records in the database
When logging in the operations database, clients can resolve to data changes
VII. Client Code
Https://github.com/smile0327/canal-test.git
Note: I am using the 1.0.22 version here. With the 1.0.25 version, if MySQL and canal server are on the same machine, the program will not error, but the canal server cannot consume the Binlog log.
Using Canal to parse MySQL binlog logs