cdc任务删不掉

为提高效率,请提供以下信息,问题描述清晰能够更快得到解决:
【 TiDB 使用环境】
centos7.5 tidb 5.0.0

【概述】 场景 + 问题概述
用cdc创建多个相同的上下游任务,出现deadlock,我现在想把这几个任务删掉,但是使用这个命令删不掉
tiup cdc cli changefeed remove --pd=http://172.16.16.44:2379 --changefeed-id replication-task-1
另外我想问一下cdc的增量备份策略,会把删除操作也同步执行下来吗,比如我在tidb里删了任务中的某张表,下游mysql会同步执行吗
cdc任务start-ts设置最早是只能设置到kv节点上次的gc时间吗
【备份和数据迁移策略逻辑】
从上游tidb备份数据到mysql
【背景】 做过哪些操作
建立了多个相同的上下游任务,现在删不掉了
【现象】 业务和数据库现象

【问题】 当前遇到的问题
删不掉cdc任务
【业务影响】
没办法同步
【TiDB 版本】
5.0.0
【附件】

  • 相关日志、配置文件、Grafana 监控(https://metricstool.pingcap.com/)
  • TiUP Cluster Display 信息
  • TiUP CLuster Edit config 信息
  • TiDB-Overview 监控
  • 对应模块的 Grafana 监控(如有 BR、TiDB-binlog、TiCDC 等)
  • 对应模块日志(包含问题前后 1 小时日志)

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

1 个赞

1.可以尝试添加选项 --force 强制删除下 changefeed 任务;
2.开启 DDL 同步后,应该会将 drop 操作同步到下游;
3.start-ts 设置的时间必须在 gc save point 点之内,如果想设置更早的时间,可以把 gc 时间调大点。

2 个赞

那我要是删除某张表里的某条数据呢,下游也会删除吗

1 个赞

会的 , 这是 cdc 类工具的基本功能

2 个赞

如果说cdc后边接的kafka,然后后边接mysql呢,下游的mysql会同步delete和drop操作吗

1 个赞

话说我出现这种情况的原因是因为tidb是5.0.0但是cdc是5.1.0吗

1 个赞

应该是创建了重复的任务导致的,不过 ticdc 版本尽量和 tidb 版本保持一致,防止出现不兼容的问题。

2 个赞

用force停止不了,现在能重启cdc集群吗

1 个赞

可以重启,重启后再观察下能否恢复正常

1 个赞

尝试了下,并没有恢复正常,之前的同步任务还在,而且用force删不掉。现在能不能scale-in cdc节点

1 个赞

如果你只是测试的话可以把 cdc 节点卸载后重新安装下。

2 个赞

我删了cdc重装之后,同步任务还在:sweat_smile:。有没有什么建议把同步任务干掉

1 个赞

cdc 都删掉了同步任务还在? 你具体的操作步骤是怎么样的?

我用scale-in删掉的cdc,然后又用scale-out重装了cdc,结果再用dc cli changefeed list看,之前的同步任务还在:sweat_smile:

是整个 ticdc 都卸载掉了重新安装的吗?

用的scale-in命令,应该里边的数据都销毁了吧

总共有几个 cdc 进程,是 scale-in 全部还是部分?可以反馈下 cdc cli capture list --pd=http://{pd_ip}:{port} 的结果

全部的cdc,因为我在测试,所以只装了一个cdc。刚才又装了下cdc,同步任务竟然还在
(base) [root@tidb0003 ~]# tiup cdc cli changefeed list --pd=http://172.16.16.44:2379
Found cdc newer version:

The latest version:         v5.1.1
Local installed version:    v5.1.0
Update current component:   tiup update cdc
Update all components:      tiup update --all

Starting component cdc: /root/.tiup/components/cdc/v5.1.0/cdc cli changefeed list --pd=http://172.16.16.44:2379
[
{
“id”: “replication-tast-1”,
“summary”: {
“state”: “stopped”,
“tso”: 426604096601718785,
“checkpoint”: “2021-07-27 13:58:00.811”,
“error”: {
“addr”: “172.16.16.44:8300”,
“code”: “CDC:ErrProcessorUnknown”,
“message”: “[CDC:ErrMySQLTxnError]Error 1146: Table ‘spider.aba_searchterm’ doesn’t exist”
}
}
},
{
“id”: “replication-tast-2”,
“summary”: {
“state”: “stopped”,
“tso”: 426604318965366787,
“checkpoint”: “2021-07-27 14:12:09.061”,
“error”: {
“addr”: “172.16.16.44:8300”,
“code”: “CDC:ErrProcessorUnknown”,
“message”: “[CDC:ErrMySQLTxnError]Error 1146: Table ‘spider.aba_searchterm’ doesn’t exist”
}
}
},
{
“id”: “replication-tast-3”,
“summary”: {
“state”: “stopped”,
“tso”: 426606403547561985,
“checkpoint”: “2021-07-27 16:24:41.111”,
“error”: {
“addr”: “172.16.16.44:8300”,
“code”: “CDC:ErrProcessorUnknown”,
“message”: “[CDC:ErrMySQLTxnError]Error 1213: Deadlock found when trying to get lock; try restarting transaction”
}
}
},
{
“id”: “replication-tast-4”,
“summary”: {
“state”: “stopped”,
“tso”: 426601096298102784,
“checkpoint”: “2021-07-27 10:47:15.561”,
“error”: {
“addr”: “172.16.16.44:8300”,
“code”: “CDC:ErrProcessorUnknown”,
“message”: “[CDC:ErrMySQLTxnError]Error 1213: Deadlock found when trying to get lock; try restarting transaction”
}
}
},
{
“id”: “replication-tast-5”,
“summary”: {
“state”: “stopped”,
“tso”: 426607665390813185,
“checkpoint”: “2021-07-27 17:44:54.661”,
“error”: {
“addr”: “172.16.16.44:8300”,
“code”: “CDC:ErrProcessorUnknown”,
“message”: “[CDC:ErrMySQLTxnError]Error 1213: Deadlock found when trying to get lock; try restarting transaction”
}
}
}
]

不太符合预期,你现在执行强制删除 changefeed 会有什么提示吗?麻烦把 cdc cli changefeed remove --pd=http://{pd_ip}:{port} --changefeed-id {task-name} --force 执行结果反馈下,谢谢

starting后边就没了

(base) [root@tidb0003 ~]# tiup cdc cli changefeed remove -c replication-task-1 --pd=http://172.16.16.44:2379 -f
Found cdc newer version:

The latest version:         v5.1.1
Local installed version:    v5.1.0
Update current component:   tiup update cdc
Update all components:      tiup update --all

Starting component cdc: /root/.tiup/components/cdc/v5.1.0/cdc cli changefeed remove -c replication-task-1 --pd=http://172.16.16.44:2379 -f