1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| 首先咱们看下Adapter的日志情况 2021-12-08 14:20:04.333 [pool-10-thread-1] INFO c.a.o.canal.client.adapter.logger.LoggerAdapterExample - DML: {"data":[{"id":"2","value":"3"}],"database":"temp","destination":"canal_temp","es":1638944403000,"groupId":"g1","isDdl":false,"old":null,"pkNames":null,"sql":"","table":"test","ts":1638944404125,"type":"INSERT"} 2021-12-08 14:20:04.399 [pool-6-thread-1] DEBUG c.a.o.canal.client.adapter.rdb.service.RdbSyncService - DML: {"data":{"id":"2","value":"3"},"database":"temp","destination":"canal_temp","old":null,"table":"test","type":"INSERT"} 2021-12-08 14:21:45.318 [pool-10-thread-1] INFO c.a.o.canal.client.adapter.logger.LoggerAdapterExample - DML: {"data":[{"id":"2","value":"4"}],"database":"temp","destination":"canal_temp","es":1638944505000,"groupId":"g1","isDdl":false,"old":[{"value":"3"}],"pkNames":null,"sql":"","table":"test","ts":1638944505276,"type":"UPDATE"} 2021-12-08 14:21:45.483 [pool-6-thread-1] DEBUG c.a.o.canal.client.adapter.rdb.service.RdbSyncService - DML: {"data":{"id":"2","value":"4"},"database":"temp","destination":"canal_temp","old":{"value":"3"},"table":"test","type":"UPDATE"} 2021-12-08 14:24:06.777 [pool-10-thread-1] INFO c.a.o.canal.client.adapter.logger.LoggerAdapterExample - DML: {"data":[{"id":"2","value":"4"}],"database":"temp","destination":"canal_temp","es":1638944646000,"groupId":"g1","isDdl":false,"old":null,"pkNames":null,"sql":"","table":"test","ts":1638944646718,"type":"DELETE"} 2021-12-08 14:24:06.841 [pool-6-thread-1] DEBUG c.a.o.canal.client.adapter.rdb.service.RdbSyncService - DML: {"data":{"id":"2","value":"4"},"database":"temp","destination":"canal_temp","old":null,"table":"test","type":"DELETE"}
可以看到DML操作被Adapter捕捉,然后操作Sink端数据
接着看下Kafka内的数据 {"data":null,"database":"","es":1638782059000,"id":2,"isDdl":false,"mysqlType":null,"old":null,"pkNames":null,"sql":"CREATE DATABASE `copy` CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_general_ci'","sqlType":null,"table":"","ts":1638782059582,"type":"QUERY"} {"data":[{"id":"2","value":"3"}],"database":"temp","es":1638944403000,"id":3,"isDdl":false,"mysqlType":{"id":"varchar(12)","value":"varchar(12)"},"old":null,"pkNames":null,"sql":"","sqlType":{"id":12,"value":12},"table":"test","ts":1638944404125,"type":"INSERT"} {"data":[{"id":"2","value":"4"}],"database":"temp","es":1638944505000,"id":4,"isDdl":false,"mysqlType":{"id":"varchar(12)","value":"varchar(12)"},"old":[{"value":"3"}],"pkNames":null,"sql":"","sqlType":{"id":12,"value":12},"table":"test","ts":1638944505276,"type":"UPDATE"} {"data":[{"id":"2","value":"4"}],"database":"temp","es":1638944646000,"id":7,"isDdl":false,"mysqlType":{"id":"varchar(12)","value":"varchar(12)"},"old":null,"pkNames":null,"sql":"","sqlType":{"id":12,"value":12},"table":"test","ts":1638944646718,"type":"DELETE"}
创建库的咱们忽略,这个是需要剔除掉的,主要的数据是DML操作记录数据 更新时old字段中会包含修改前的数据,这里好像做过优化,只有修改字段,未修改的字段不会包括在内
|