tidb-lightning导入数据报错:Error: tidb-lightning pre-check failed: table(s) [`car_news`.`es_charge_bill`, `car_news`.`es_charge_owner_fee`] are not empty

【 TiDB 使用环境】生产
【 TiDB 版本】V5.4.0
【遇到的问题】使用dumpling从mysql库中导出的几张表结构和数据,想使用tidb-lightning导入到tidb集群中,这两张表已经存在,且有数据,导入的数据想以append追加的方式,导入到tidb集群中的这两张表中。需要做哪些配置呢?
【复现路径】目前的配置如下:
【问题现象及影响】
使用dumpling从mysql库中导出的几张表结构和数据,想使用tidb-lightning导入到tidb集群中,这两张表已经存在,且有数据,导入的数据想以append追加的方式,导入到tidb集群中的这两张表中。需要做哪些配置呢?

我的关键点配置如下:
[[routes]]
schema-pattern = “car”
table-pattern = “es_charge_bill”
target-schema = “car_news”
target-table = “es_charge_bill”

[[routes]]
schema-pattern = “car”
table-pattern = “es_charge_owner_fee”
target-schema = “car_news”
target-table = “es_charge_owner_fee”

±–±-----------------------------------------------------------------------------------------------±------------±-------+
| # | CHECK ITEM | TYPE | PASSED |
±–±-----------------------------------------------------------------------------------------------±------------±-------+
| 1 | Source csv files size is proper | performance | true |
±–±-----------------------------------------------------------------------------------------------±------------±-------+
| 2 | checkpoints are valid | critical | true |
±–±-----------------------------------------------------------------------------------------------±------------±-------+
3 | table schemas are valid | critical | true |
±–±-----------------------------------------------------------------------------------------------±------------±-------+
| 4 | table(s) [car_news.es_charge_bill, car_news.es_charge_owner_fee] are not empty | critical | false |
±–±-----------------------------------------------------------------------------------------------±------------±-------+
| 5 | Cluster is available | critical | true |
±–±-----------------------------------------------------------------------------------------------±------------±-------+
| 6 | Lightning has the correct storage permission | critical | true |
±–±-----------------------------------------------------------------------------------------------±------------±-------+

Error: tidb-lightning pre-check failed: table(s) [car_news.es_charge_bill, car_news.es_charge_owner_fee] are not empty
tidb lightning encountered error: tidb-lightning pre-check failed: table(s) [car_news.es_charge_bill, car_news.es_charge_owner_fee] are not empty

从日志报错来看,是提示我这两张表不为空,我的这两张表确实里面有数据。我想保留这2张表中的数据的前提下,导入时,以append追加的形式插入新数据到这两张表中。应该如何配置实现呢?

【附件】

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

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

2 个赞

使用场景不匹配
image

单纯只是导入这两张表的话,建议:

  1. mysqldump导出sql脚本,source导入tidb
  2. DM增量同步
1 个赞

上面的操作,我只是简单测试了几张表的导入操作,我们的场景如下:
1.每次增量数据会涉及到至少几十张业务表
2.这些表的增量数据在导入目标库时,想做追加处理
3.其中会有3~5张大表增量数据,数据量级在2000万左右

这些场景的话,有没有什么好的解决办法?

这种场景建议使用DM增量同步

1 个赞

增量数据建议使用DM靠谱

好的,谢谢,我看一下DM

好的,谢谢

lightning 也支持增量导入的,可以看看这个配置:

https://docs.pingcap.com/zh/tidb/stable/tidb-lightning-configuration

incremental-import = true

不过如果想要持续不断导入,还是建议用 DM

1 个赞

该主题在最后一个回复创建后60天后自动关闭。不再允许新的回复。