cdc 同步到kafka无数据

为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。

  • 【TiDB 版本】:
  • 【问题描述】:

若提问为性能优化、故障排查类问题,请下载脚本运行。终端输出的打印结果,请务必全选并复制粘贴上传。

changefeed query如下:

check_point还是昨天部署时的时间,一直没有动。kafka里面也没有消息。tidb已经有写操作了。

processor list也没有问题:

详细的changefeed query如下:



cdc也没有错误日志

resolved-ts 为0

同步表结构是什么样子的。
集群和工具版本
cdc log 辛苦提供下

同步到kafka,表结构也有关系吗?
CREATE TABLE myBook (
userId int(11) unsigned NOT NULL COMMENT ‘用户Id’,
shopId int(11) unsigned NOT NULL COMMENT ‘店铺Id’,
itemId bigint(20) unsigned NOT NULL COMMENT ‘商品Id’,
itemName varchar(255) NOT NULL DEFAULT ‘’ COMMENT ‘商品名称’,
catId bigint(20) unsigned DEFAULT 0 COMMENT ‘商品分类编号’,
imgUrl varchar(255) NOT NULL DEFAULT ‘’ COMMENT ‘首图’,
price decimal(10,2) unsigned NOT NULL DEFAULT 0.00 COMMENT ‘价格’,
quality int(11) NOT NULL DEFAULT 0 COMMENT ‘品相’,
number int(11) NOT NULL DEFAULT 0 COMMENT ‘数量’,
createdTime int(11) NOT NULL DEFAULT 0 COMMENT ‘购买时间’,
isDel int(11) NOT NULL DEFAULT 0 COMMENT ‘是否删除 0未删除 1删除’,
createTime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
modifyTime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (userId,itemId,createdTime),
KEY userId (userId),
KEY modifyTime (modifyTime),
KEY createdtime_itemid (createdTime,itemId)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT=‘我买到的书’

集群是4.0.6
tiup: 1.2.3
ticdc: 4.0.6

1 个赞

cdc全部日志:
[2021/01/19 15:17:38.561 +08:00] [INFO] [capture.go:237] [“run processor”] [captureid=a3040f38-57b0-4a0e-b043-bedd171b1c8b] [changefeedid=sold-product]

[2021/01/19 15:17:38.626 +08:00] [INFO] [kafka.go:261] [“Starting kafka sarama producer …”] [config="{“PartitionNum”:6,“ReplicationFactor”:1,“Version”:“2.2.0”,“MaxMessageBytes”:67108864,“Compression”:“none”,“ClientID”:"",“Credential”:{“ca-path”:"",“cert-path”:"",“key-path”:"",“cert-allowed-cn”:null}}"]

[2021/01/19 15:17:38.810 +08:00] [INFO] [kafka.go:290] [“get partition number of topic”] [topic=sold_product] [partition_num=6]

[2021/01/19 15:17:38.812 +08:00] [INFO] [client.go:148] ["[pd] create pd client with endpoints"] [pd-address="[http://192.168.3.115:2379]"]

[2021/01/19 15:17:38.818 +08:00] [INFO] [base_client.go:253] ["[pd] switch leader"] [new-leader=http://192.168.3.115:2379] [old-leader=]

[2021/01/19 15:17:38.818 +08:00] [INFO] [base_client.go:103] ["[pd] init cluster id"] [cluster-id=6757211481730004555]

[2021/01/19 15:17:38.818 +08:00] [INFO] [processor.go:177] [“start processor with startts”] [startts=422324642032648193]

[2021/01/19 15:17:39.033 +08:00] [INFO] [client.go:295] [“get clusterID”] [id=6757211481730004555]

[2021/01/19 15:17:39.034 +08:00] [INFO] [client.go:295] [“get clusterID”] [id=6757211481730004555]

[2021/01/19 15:17:39.088 +08:00] [INFO] [region_range_lock.go:217] [“range locked”] [lockID=2] [regionID=15321] [startKey=7480000000000003ffbb5f720000000000fa] [endKey=7480000000000003ffbb5f730000000000fa] [checkpointTs=422324642032648193]

[2021/01/19 15:17:39.088 +08:00] [INFO] [client.go:715] [“creating new stream to store to send request”] [regionID=15321] [requestID=5] [storeID=1] [addr=192.168.1.136:20160]

[2021/01/19 15:17:39.089 +08:00] [INFO] [region_range_lock.go:217] [“range locked”] [lockID=1] [regionID=16129] [startKey=7480000000000004ff395f720000000000fa] [endKey=7480000000000004ff395f730000000000fa] [checkpointTs=422324642032648193]

[2021/01/19 15:17:39.089 +08:00] [INFO] [client.go:715] [“creating new stream to store to send request”] [regionID=16129] [requestID=6] [storeID=1] [addr=192.168.1.136:20160]

[2021/01/19 15:17:39.097 +08:00] [INFO] [puller.go:247] [“puller is initialized”] [duration=12.222889ms] [changefeedid=sold-product] [tableID=955] [spans="["[7480000000000003ffbb5f720000000000fa, 7480000000000003ffbb5f730000000000fa)"]"] [resolvedTs=422324642032648193]

[2021/01/19 15:17:39.097 +08:00] [INFO] [puller.go:247] [“puller is initialized”] [duration=63.267054ms] [changefeedid=sold-product] [tableID=1081] [spans="["[7480000000000004ff395f720000000000fa, 7480000000000004ff395f730000000000fa)"]"] [resolvedTs=422324642032648193]

[2021/01/19 17:42:01.972 +08:00] [WARN] [pd.go:109] [“get timestamp too slow”] [“cost time”=45.285893ms]

[2021/01/19 18:15:48.017 +08:00] [WARN] [pd.go:109] [“get timestamp too slow”] [“cost time”=90.198046ms]

[2021/01/19 18:21:37.983 +08:00] [WARN] [pd.go:109] [“get timestamp too slow”] [“cost time”=57.045962ms]

[2021/01/19 22:46:31.967 +08:00] [WARN] [pd.go:109] [“get timestamp too slow”] [“cost time”=40.447521ms]

[2021/01/19 22:48:21.969 +08:00] [WARN] [pd.go:109] [“get timestamp too slow”] [“cost time”=42.268315ms]

[2021/01/20 03:09:49.975 +08:00] [WARN] [pd.go:109] [“get timestamp too slow”] [“cost time”=49.159899ms]

[2021/01/20 07:33:35.958 +08:00] [WARN] [pd.go:109] [“get timestamp too slow”] [“cost time”=31.531069ms]

[2021/01/20 07:37:55.980 +08:00] [WARN] [pd.go:109] [“get timestamp too slow”] [“cost time”=53.239266ms]

[2021/01/20 07:51:39.130 +08:00] [WARN] [pd.go:109] [“get timestamp too slow”] [“cost time”=33.259622ms]

[2021/01/20 07:52:23.986 +08:00] [WARN] [pd.go:109] [“get timestamp too slow”] [“cost time”=59.288135ms]

[2021/01/20 07:54:14.007 +08:00] [WARN] [pd.go:109] [“get timestamp too slow”] [“cost time”=80.508381ms]

[2021/01/20 08:36:44.138 +08:00] [WARN] [pd.go:109] [“get timestamp too slow”] [“cost time”=41.186062ms]

[2021/01/20 12:00:01.999 +08:00] [WARN] [pd.go:109] [“get timestamp too slow”] [“cost time”=70.541042ms]

[2021/01/20 12:02:01.965 +08:00] [WARN] [pd.go:109] [“get timestamp too slow”] [“cost time”=38.767728ms]

[2021/01/20 12:10:41.965 +08:00] [WARN] [pd.go:109] [“get timestamp too slow”] [“cost time”=38.678202ms]

[2021/01/20 12:18:39.972 +08:00] [WARN] [pd.go:109] [“get timestamp too slow”] [“cost time”=45.929964ms]

[2021/01/20 14:35:54.178 +08:00] [WARN] [pd.go:109] [“get timestamp too slow”] [“cost time”=72.932251ms]

[2021/01/20 15:55:35.971 +08:00] [WARN] [pd.go:109] [“get timestamp too slow”] [“cost time”=44.218301ms]

[2021/01/20 15:58:25.958 +08:00] [WARN] [pd.go:109] [“get timestamp too slow”] [“cost time”=31.209014ms]

[2021/01/20 16:29:01.956 +08:00] [WARN] [pd.go:109] [“get timestamp too slow”] [“cost time”=30.06689ms]

resolved-ts 为0

麻烦抓一下进程当前的 goroutine 看一下:

访问 cdcip:cdcport/debug/pprof/goroutine?debug=2

贴一下对应页面的内容,多谢

感觉遇到这个问题,

goroutine.txt (194.1 KB)

我们不是到mysql,是到kafka

  1. 把这个 changefeed 删掉
  2. 重启 cdc 集群,当前 cdc 集群已经卡住了
  3. 用4.0.6的cli 重建changefeed(当前使用的 cli 是 v5.0.0-rc:tiup cdc:v4.0.6 cli xxx

辛苦按照步骤严格执行,并对输出进行文本记录,反馈到帖子中。
对应 issue:https://github.com/pingcap/ticdc/issues/1306

好的。

重新建立changefeed时,提升changefeed已经存在了。我严格按照步骤来的,也已经删除changefeed了,并且现在changefeed list也显示为空

cdc cli changefeed remove -c xxx -f

(话说上面 remove 命令执行了吗

按照上面步骤执行了吗,可以讲下你的操作步骤

严格按照你要求的操作的,不过没有加-f参数。
我加了 -f 参数后,已经彻底删除了changefeed。也已经成功新建了changefeed了。
不过,问题依旧,还是不同步。

我今天尝试了另一个4.0.6的集群,没有问题。4.0.8还是有问题,我把4.0.8升级到了4.0.10也好了。

所以出问题的集群版本是不是写错了。

这个问题的关键是 ctl 的版本,要用相匹配的,并且需要重启 cdc 集群。

如果有操作记录辛苦发出来看下。

我们有多个集群,有4.0.6也有4.0.8,最开始没有考虑版本的问题,就回复了4.0.6。
出问题的是4.0.8。
操作记录很简单,严格按照你说的步骤来的,版本也没有写错。

辛苦再进行操纵,看是否出现 changefeed name 冲突的的问题,尝试使用不同 name 看是否可以创建成功,

PS:希望记录步骤,便于定位问题。

升级后就不好回退了

我应该没让操作过升级。