xingwenge / canal-php

Alibaba mysql database binlog incremental subscription & consumer components Canal's php client[阿里巴巴mysql数据库binlog的增量订阅&消费组件 Canal 的 php 客户端 ] https://github.com/alibaba/canal
385 stars 67 forks source link

请问: 执行sample/client.php文件, 可以打印出sql语句,后面的具体字段和值都为空. 可能是什么原因呢? #9

Open q1006882982 opened 4 years ago

loving-irene commented 4 years ago

也碰到了类似的情况

server 搭好了,客户端代码使用的是 sample

最后在 mysql 中 insert 或者 update,客户端打印出来的如下 ================> binlog[mysql-bin.000013 : 4720],name[canal,user], eventType: 2 update user setage=302 wherename='title'

查看了 example 和 canal 下的日志

example 下只有 2020-10-09 11:33:23.768 [MultiStageCoprocessor-other-example-0] WARN c.a.o.canal.parse.inbound.mysql.tsdb.DatabaseTableMeta - dup apply for sql : create table if not exists user( name char(24), age int(8) ) 2020-10-09 11:34:13.304 [New I/O server worker #1-1] INFO c.a.otter.canal.instance.core.AbstractCanalInstance - subscribe filter change to .*\..* 2020-10-09 11:34:13.304 [New I/O server worker #1-1] WARN c.a.o.canal.parse.inbound.mysql.dbsync.LogEventConvert - --> init table filter : ^.*\..*$ 2020-10-09 15:01:48.521 [New I/O server worker #1-2] INFO c.a.otter.canal.instance.core.AbstractCanalInstance - subscribe filter change to .*\..* 2020-10-09 15:01:48.535 [New I/O server worker #1-2] WARN c.a.o.canal.parse.inbound.mysql.dbsync.LogEventConvert - --> init table filter : ^.*\..*$ 2020-10-09 15:21:43.401 [New I/O server worker #1-1] INFO c.a.otter.canal.instance.core.AbstractCanalInstance - subscribe filter change to .*\..* 2020-10-09 15:21:43.402 [New I/O server worker #1-1] WARN c.a.o.canal.parse.inbound.mysql.dbsync.LogEventConvert - --> init table filter : ^.*\..*$ 2020-10-09 15:22:37.589 [New I/O server worker #1-2] INFO c.a.otter.canal.instance.core.AbstractCanalInstance - subscribe filter change to .*\..* 2020-10-09 15:22:37.589 [New I/O server worker #1-2] WARN c.a.o.canal.parse.inbound.mysql.dbsync.LogEventConvert - --> init table filter : ^.*\..*$ 2020-10-09 15:23:20.347 [New I/O server worker #1-1] INFO c.a.otter.canal.instance.core.AbstractCanalInstance - subscribe filter change to .*\..* 2020-10-09 15:23:20.347 [New I/O server worker #1-1] WARN c.a.o.canal.parse.inbound.mysql.dbsync.LogEventConvert - --> init table filter : ^.*\..*$ 2020-10-09 16:14:09.370 [New I/O server worker #1-2] INFO c.a.otter.canal.instance.core.AbstractCanalInstance - subscribe filter change to .*\..* 2020-10-09 16:14:09.375 [New I/O server worker #1-2] WARN c.a.o.canal.parse.inbound.mysql.dbsync.LogEventConvert - --> init table filter : ^.*\..*$ 2020-10-09 16:21:56.942 [New I/O server worker #1-1] INFO c.a.otter.canal.instance.core.AbstractCanalInstance - subscribe filter change to .*\..* 2020-10-09 16:21:56.942 [New I/O server worker #1-1] WARN c.a.o.canal.parse.inbound.mysql.dbsync.LogEventConvert - --> init table filter : ^.*\..*$

canal.log下没有报错信息

loving-irene commented 4 years ago

已经解决了,MySQL 配置 binlog-format 的问题,配置了 /etc/my.cnf 之后重启并没有生效,在 mysql 客户端中才检查出来。

配置之后就能够拿到,需要注意的是 mysql 的配置有 global 和 session 两个级别。