【 TiDB 使用环境】生产环境
【 TiDB 版本】v7.5.5
【遇到的问题:问题现象及影响】
tidb使用ticdc进行同步到下游tidb集群,为了保持数据一致性,使用了redo log,但是redo log一直增长不删除
ticdc配置文件为:
[consistent]
# eventual consistency:使用 redo log,提供上游灾难情况下的最终一致性。
level = "eventual"
# 单个 redo log 文件大小,单位 MiB,默认值 64,建议该值不超过 128。
max-log-size = 64
# 刷新或上传 redo log 至 S3 的间隔,单位毫秒,默认 1000,建议范围 500-2000。
flush-interval = 2000
# 存储 redo log 的地址
storage = "local:///disk1/zhongtai_bak_redo"
ticdc创建任务为:
./cdc cli changefeed create --pd=http://xxxx:3379 --sink-uri="mysql://root:xxxxxxx@xxxxx:4001/" --changefeed-id="ticdc-zhongtai-bak" --config=/home/tidb/changefeed_zhongtai_bak.toml --start-ts=456128358773424215
1 个赞
WalterWj
(王军 - PingCAP)
2
redo 默认下游应用了就会清理
。难道同步延迟很高?
1 个赞
除了检查redo日志的配置 建议检查下GC/ CDC的检查点
同步正常,没有延迟,同步cdc任务tso也一直在增长
“id”: “ticdc-zhongtai-bak”,
“namespace”: “default”,
“summary”: {
“state”: “normal”,
“tso”: 456293561684197388,
“checkpoint”: “2025-02-27 10:03:22.079”,
“error”: null
cdc任务看着也没问题
1 个赞
日志里唯一的错误是[ERROR] [client.go:1053] [“region worker exited with error”],不过这个不止同步cdc任务有这个报错,其他cdc任务也会有这个报错,但是cdc任务一直都没啥问题。
刚开始以为是旧版本v6.5.2的cdc bug,前两天刚升级了版本到v7.5.5,组件相当于全重启了一遍了
cdc.log (98.8 MB)
日志的前部分有些报错事因为正在升级,升级完后,后边的日志看着没啥问题,都是info级别的
乡在人间
(Ti D Ber Ki Nyc B Fs)
14
一般同步完redo log会自动清理的,为啥没有触发清理机制,可以从这方面排查下
帮看下是上面的ticdc任务的配置文件写的有问题?还是ticdc任务创建的写法有问题?cdc任务目前看着一直都是没问题的,跟下游实时同步着
检查了 cdc 日志,没有发现“"redo manager log GC fail”,因此应该并没有清理失败的现象。可能没有触发清理?这需要用户上传一下
find /disk1/zhongtai_bak_redo -name "*.log" -exec ls {} \;
的结果才能判断。
已经积累了几百G的.log这样的小文件了 。执行find /disk1/zhongtai_bak_redo -name “*.log” -exec ls {} ;因为文件太多,显示不出来
看了另外一个小集群的,redo log下的这种.log文件,看日期是从cdc同步任务开始创建后的日志都没清理。
一、检查下游同步状态
1.确认同步延迟:
在下游tidb中抽查了几个更新比较频繁的表,行数跟上游tidb行数一致,且随着上游变化而变化,
2.查看TICDC监控指标:
监控面板上看cdc任务也没有延迟。
二、检查Redo Log配置:
- 确认配置有效性
添加retention-time后更新cdc任务失败,报错如下:
[2025/03/06 14:23:45.616 +08:00] [ERROR] [cli_changefeed_update.go:164] [“decode config file error”] [error=“component TiCDC changefeed’s config file /home/tidb/changefeed_xiaochu_bak.toml contained unknown configuration options: consistent.retention-time”] [errorVerbose=“component TiCDC changefeed’s config file /home/tidb/changefeed_xiaochu_bak.toml contained unknown configuration options: consistent.retention-time\ngithub.com/pingcap/tiflow/pkg/cmd/util.StrictDecodeFile\n\tgithub.com/pingcap/tiflow/pkg/cmd/util/helper.go:151\ngithub.com/pingcap/tiflow/pkg/cmd/cli.(*changefeedCommonOptions).strictDecodeConfig\n\tgithub.com/pingcap/tiflow/pkg/cmd/cli/cli_changefeed_create.go:91\ngithub.com/pingcap/tiflow/pkg/cmd/cli.(*updateChangefeedOptions).applyChanges.func1\n\tgithub.com/pingcap/tiflow/pkg/cmd/cli/cli_changefeed_update.go:163\ngithub.com/spf13/pflag.(*FlagSet).Visit\n\tgithub.com/spf13/pflag@v1.0.5/flag.go:336\ngithub.com/pingcap/tiflow/pkg/cmd/cli.(*updateChangefeedOptions).applyChanges\n\tgithub.com/pingcap/tiflow/pkg/cmd/cli/cli_changefeed_update.go:155\ngithub.com/pingcap/tiflow/pkg/cmd/cli.(*updateChangefeedOptions).run\n\tgithub.com/pingcap/tiflow/pkg/cmd/cli/cli_changefeed_update.go:101\ngithub.com/pingcap/tiflow/pkg/cmd/cli.newCmdUpdateChangefeed.func1\n\tgithub.com/pingcap/tiflow/pkg/cmd/cli/cli_changefeed_update.go:201\ngithub.com/spf13/cobra.(*Command).execute\n\tgithub.com/spf13/cobra@v1.8.0/command.go:987\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\tgithub.com/spf13/cobra@v1.8.0/command.go:1115\ngithub.com/spf13/cobra.(*Command).Execute\n\tgithub.com/spf13/cobra@v1.8.0/command.go:1039\ngithub.com/pingcap/tiflow/pkg/cmd.Run\n\tgithub.com/pingcap/tiflow/pkg/cmd/cmd.go:50\nmain.main\n\t./main.go:22\nruntime.main\n\truntime/proc.go:267\nruntime.goexit\n\truntime/asm_amd64.s:1650”]
Error: component TiCDC changefeed’s config file /home/tidb/changefeed_xiaochu_bak.toml contained unknown configuration options: consistent.retention-time
- 检查存储目录权限
目录权限没问题,空间充足。
三、排查已知版本问题:
1.检查TICDC日志
grep “redo log” cdc.log | grep -i “error|warning”
并没有发现有 failed to clean up redo log
或权限错误日志。
2.确认TICDC版本
Release Version: v7.5.5
四、 临时清理与预防措施
find /disk1/zhongtai_bak_redo -name “*.log” -mtime +1 -exec rm -f {} ;
手动清理试了下,可以删除。