bingoohuang / blog

write blogs with issues
MIT License
178 stars 24 forks source link

Canal 实验 #196

Open bingoohuang opened 3 years ago

bingoohuang commented 3 years ago

Canal 实验

想验证一下otter会不会同步新建表的分区,先验证一下它所依赖的Canal是否支持呢,于是就自己验证一下咯。

  1. 下载:在 Canal Releases 下载 canal.deployercanal.example
  2. 解压:tar zxf canal.deployer-1.1.5.tar.gz -C canal.deployer-1.1.5, tar zxf canal.example-1.1.5.tar.gz -C canal.example-1.1.5
  3. 配置 canal.deployer-1.1.5/conf/example/instance.properties
    canal.instance.master.address=127.0.0.1:3306
    canal.instance.dbUsername=root
    canal.instance.dbPassword=root
  4. 启动Canal服务 canal.deployer-1.1.5/bin/startup.sh
  5. 启动示例客户端 canal.example-1.1.5/bin/startup.sh
  6. 跟踪客户端日志 tail -f canal.example-1.1.5/logs/example/entry.log
****************************************************
* Batch Id: [1] ,count : [3] , memsize : [274] , Time : 2021-04-23 15:06:33
* Start : [mysql-bin.000015:259:1619161149000(2021-04-23 14:59:09)]
* End : [mysql-bin.000015:566:1619161149000(2021-04-23 14:59:09)]
****************************************************

================> binlog[mysql-bin.000015:259] , executeTime : 1619161149000(2021-04-23 14:59:09) , gtid : () , delay : 444833ms
 BEGIN ----> Thread id: 18
----------------> binlog[mysql-bin.000015:407] , name[bee,t_member] , eventType : UPDATE , executeTime : 1619161149000(2021-04-23 14:59:09) , gtid : () , delay : 444835 ms
id : 5    type=bigint(20)
name : 八戒111    type=varchar(20)    update=true
sex : 1    type=tinyint(1)
citizen_id : 110822199010110022    type=char(18)
update_time : 2021-04-23 06:59:09    type=datetime    update=true
create_time : 2021-03-11 04:21:45    type=datetime
remark : 第一吃货    type=varchar(100)
----------------
 END ----> transaction id: 616
================> binlog[mysql-bin.000015:566] , executeTime : 1619161149000(2021-04-23 14:59:09) , gtid : () , delay : 444840ms

****************************************************
* Batch Id: [2] ,count : [3] , memsize : [274] , Time : 2021-04-23 15:08:21
* Start : [mysql-bin.000015:662:1619161701000(2021-04-23 15:08:21)]
* End : [mysql-bin.000015:969:1619161701000(2021-04-23 15:08:21)]
****************************************************

================> binlog[mysql-bin.000015:662] , executeTime : 1619161701000(2021-04-23 15:08:21) , gtid : () , delay : 146ms
 BEGIN ----> Thread id: 18
----------------> binlog[mysql-bin.000015:810] , name[bee,t_member] , eventType : UPDATE , executeTime : 1619161701000(2021-04-23 15:08:21) , gtid : () , delay : 148 ms
id : 7    type=bigint(20)
name : 沙僧222    type=varchar(20)    update=true
sex : 1    type=tinyint(1)
citizen_id : 110822199010110023    type=char(18)
update_time : 2021-04-23 07:08:21    type=datetime    update=true
create_time : 2021-03-11 04:21:45    type=datetime
remark : 最小师弟    type=varchar(100)
----------------
 END ----> transaction id: 644
================> binlog[mysql-bin.000015:969] , executeTime : 1619161701000(2021-04-23 15:08:21) , gtid : () , delay : 151ms

****************************************************
* Batch Id: [3] ,count : [1] , memsize : [163] , Time : 2021-04-23 15:11:09
* Start : [mysql-bin.000015:1065:1619161869000(2021-04-23 15:11:09)]
* End : [mysql-bin.000015:1065:1619161869000(2021-04-23 15:11:09)]
****************************************************

----------------> binlog[mysql-bin.000015:1065] , name[bee,t1] , eventType : CREATE , executeTime : 1619161869000(2021-04-23 15:11:09) , gtid : () , delay : 987 ms
ddl : true ,  sql ----> /* ApplicationName=DataGrip 2021.1 */ CREATE TABLE t1 (
    id INT,
    year_col INT
)

****************************************************
* Batch Id: [4] ,count : [1] , memsize : [118] , Time : 2021-04-23 15:12:00
* Start : [mysql-bin.000015:1293:1619161920000(2021-04-23 15:12:00)]
* End : [mysql-bin.000015:1293:1619161920000(2021-04-23 15:12:00)]
****************************************************

----------------> binlog[mysql-bin.000015:1293] , name[bee,t1] , eventType : ERASE , executeTime : 1619161920000(2021-04-23 15:12:00) , gtid : () , delay : 975 ms
ddl : true ,  sql ----> DROP TABLE `t1` /* generated by server */

****************************************************
* Batch Id: [5] ,count : [1] , memsize : [326] , Time : 2021-04-23 15:13:25
* Start : [mysql-bin.000015:1476:1619162005000(2021-04-23 15:13:25)]
* End : [mysql-bin.000015:1476:1619162005000(2021-04-23 15:13:25)]
****************************************************

----------------> binlog[mysql-bin.000015:1476] , name[bee,t1] , eventType : CREATE , executeTime : 1619162005000(2021-04-23 15:13:25) , gtid : () , delay : 323 ms
ddl : true ,  sql ----> /* ApplicationName=DataGrip 2021.1 */ CREATE TABLE t1 (
    id INT,
    year_col INT
)
    PARTITION BY RANGE (year_col) (
    PARTITION p0 VALUES LESS THAN (1991),
    PARTITION p1 VALUES LESS THAN (1995),
    PARTITION p2 VALUES LESS THAN (1999)
)

****************************************************
* Batch Id: [6] ,count : [1] , memsize : [182] , Time : 2021-04-23 15:13:37
* Start : [mysql-bin.000015:1867:1619162017000(2021-04-23 15:13:37)]
* End : [mysql-bin.000015:1867:1619162017000(2021-04-23 15:13:37)]
****************************************************

----------------> binlog[mysql-bin.000015:1867] , name[bee,t1] , eventType : ALTER , executeTime : 1619162017000(2021-04-23 15:13:37) , gtid : () , delay : 451 ms
ddl : true ,  sql ----> /* ApplicationName=DataGrip 2021.1 */ ALTER TABLE t1 ADD PARTITION (PARTITION p3 VALUES LESS THAN (2002))

****************************************************
* Batch Id: [7] ,count : [1] , memsize : [136] , Time : 2021-04-23 15:18:13
* Start : [mysql-bin.000015:2114:1619162293000(2021-04-23 15:18:13)]
* End : [mysql-bin.000015:2114:1619162293000(2021-04-23 15:18:13)]
****************************************************

----------------> binlog[mysql-bin.000015:2114] , name[bee,p3] , eventType : RENAME , executeTime : 1619162293000(2021-04-23 15:18:13) , gtid : () , delay : 669 ms
ddl : true ,  sql ----> /* ApplicationName=DataGrip 2021.1 */ rename table p2 to p3

****************************************************
* Batch Id: [8] ,count : [4] , memsize : [281] , Time : 2021-04-23 15:30:24
* Start : [mysql-bin.000015:2315:1619163024000(2021-04-23 15:30:24)]
* End : [mysql-bin.000015:2693:1619163024000(2021-04-23 15:30:24)]
****************************************************

================> binlog[mysql-bin.000015:2315] , executeTime : 1619163024000(2021-04-23 15:30:24) , gtid : () , delay : 232ms
 BEGIN ----> Thread id: 30
----------------> binlog[mysql-bin.000015:2455] , name[bee,t_member] , eventType : DELETE , executeTime : 1619163024000(2021-04-23 15:30:24) , gtid : () , delay : 232 ms
id : 17    type=bigint(20)
name : wukong    type=varchar(20)
sex : 1    type=tinyint(1)
citizen_id : 110822199010110012    type=char(18)
update_time : 2021-03-11 04:24:01    type=datetime
create_time : 2021-03-11 04:24:01    type=datetime
remark : yyy    type=varchar(100)

----------------> binlog[mysql-bin.000015:2605] , name[bee,t_member] , eventType : DELETE , executeTime : 1619163024000(2021-04-23 15:30:24) , gtid : () , delay : 234 ms
id : 15    type=bigint(20)
name : tangseng    type=varchar(20)
sex : 1    type=tinyint(1)
citizen_id : 110822199010110011    type=char(18)
update_time : 2021-03-11 04:24:01    type=datetime
create_time : 2021-03-11 04:24:01    type=datetime
remark : xxx    type=varchar(100)
----------------
 END ----> transaction id: 1784
================> binlog[mysql-bin.000015:2693] , executeTime : 1619163024000(2021-04-23 15:30:24) , gtid : () , delay : 235ms

****************************************************
* Batch Id: [9] ,count : [3] , memsize : [202] , Time : 2021-04-23 15:31:09
* Start : [mysql-bin.000015:2789:1619163069000(2021-04-23 15:31:09)]
* End : [mysql-bin.000015:3024:1619163069000(2021-04-23 15:31:09)]
****************************************************

================> binlog[mysql-bin.000015:2789] , executeTime : 1619163069000(2021-04-23 15:31:09) , gtid : () , delay : 268ms
 BEGIN ----> Thread id: 30
----------------> binlog[mysql-bin.000015:2929] , name[bee,t_member] , eventType : INSERT , executeTime : 1619163069000(2021-04-23 15:31:09) , gtid : () , delay : 269 ms
id : 275    type=bigint(20)    update=true
name : 燃灯    type=varchar(20)    update=true
sex : 1    type=tinyint(1)    update=true
citizen_id : 111999999999999999    type=char(18)    update=true
update_time : 2021-03-11 04:21:45    type=datetime    update=true
create_time : 2021-03-11 04:21:45    type=datetime    update=true
remark : 燃灯古佛    type=varchar(100)    update=true
----------------
 END ----> transaction id: 1815
================> binlog[mysql-bin.000015:3024] , executeTime : 1619163069000(2021-04-23 15:31:09) , gtid : () , delay : 270ms