Data Migration Between TiDB Instances (Tables or Databases)

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: TiDB之间迁移数据(表或库)

| username: Johnpan

How to migrate data between TiDB instances, such as migrating large tables or databases from one TiDB instance to another?
Version: TiDB 5.4

【TiDB Usage Environment】Production/Test Environment/POC
【TiDB Version】
【Encountered Issues】
【Reproduction Path】What operations were performed that caused the issue
【Issue Phenomenon and Impact】
【Attachments】

  • Relevant logs, configuration files, Grafana monitoring (https://metricstool.pingcap.com/)
  • TiUP Cluster Display information
  • TiUP Cluster Edit config information
  • TiDB-Overview monitoring
  • Corresponding module Grafana monitoring (if any, such as BR, TiDB-binlog, TiCDC, etc.)
  • Corresponding module logs (including logs from 1 hour before and after the issue)

If the question is related to performance optimization or troubleshooting, please download the script and run it. Please select all and copy-paste the terminal output.

| username: forever | Original post link

The official documentation is quite clear, you can refer to it; Migrate Data from TiDB Cluster to Another TiDB Cluster | PingCAP Docs

| username: ddhe9527 | Original post link

If the table or database is not large and there is sufficient downtime, you can consider using Dumpling to export data from the source TiDB and then using Lightning to import it into the target TiDB. If there are many tables or databases, you can use TiCDC to synchronize the specified tables and databases from the upstream TiDB to the downstream TiDB, and then switch the business from the upstream TiDB to the downstream TiDB during the cutover window.

| username: Hacker007 | Original post link

For databases or tables that are few in number, use Navicat.

| username: forever | Original post link

Navicat’s performance is very poor; it can hardly handle large tables.

| username: Johnpan | Original post link

In scenarios where the table is large or there are many tables in the database, choose TiCDC.

| username: ddhe9527 | Original post link

That’s right, this way the cutover window won’t be too long.