(5) 导入 [tidb@monitor ~]$ tiup tidb-lightning -config tidb-lightning.toml Starting component tidb-lightning: /home/tidb/.tiup/components/tidb-lightning/v8.5.3/tidb-lightning -config tidb-lightning.toml Verbose debug logs will be written to tidb-lightning.log
+----+-------------------------------------------------------------------------------------------------------+-------------+--------+ | # | CHECK ITEM | TYPE | PASSED | +----+-------------------------------------------------------------------------------------------------------+-------------+--------+ | 1 | Source data files size is proper | performance | true | +----+-------------------------------------------------------------------------------------------------------+-------------+--------+ | 2 | the checkpoints are valid | critical | true | +----+-------------------------------------------------------------------------------------------------------+-------------+--------+ | 3 | table schemas are valid | critical | true | +----+-------------------------------------------------------------------------------------------------------+-------------+--------+ | 4 | all importing tables on the target are empty | critical | true | +----+-------------------------------------------------------------------------------------------------------+-------------+--------+ | 5 | source csv files contains header row but `mydumper.csv.header` is false, checked table is `test`.`t2` | critical | false | +----+-------------------------------------------------------------------------------------------------------+-------------+--------+ | 6 | Cluster version check passed | critical | true | +----+-------------------------------------------------------------------------------------------------------+-------------+--------+ | 7 | Lightning has the correct storage permission | critical | true | +----+-------------------------------------------------------------------------------------------------------+-------------+--------+ | 8 | local source dir and temp-kv dir are in different disks | performance | true | +----+-------------------------------------------------------------------------------------------------------+-------------+--------+ | 9 | local disk resources are rich, estimate sorted data size 17B, local available is 27.66GiB | critical | true | +----+-------------------------------------------------------------------------------------------------------+-------------+--------+ | 10 | The storage space is rich, which TiKV/Tiflash is 135.3GiB/0B. The estimated storage space is 51B/0B. | performance | true | +----+-------------------------------------------------------------------------------------------------------+-------------+--------+ | 11 | Cluster doesn't have too many empty regions | performance | true | +----+-------------------------------------------------------------------------------------------------------+-------------+--------+ | 12 | Cluster region distribution is balanced | performance | true | +----+-------------------------------------------------------------------------------------------------------+-------------+--------+ | 13 | found PiTR log streaming task(s): [pitr], | critical | false | | | local backend is not compatible with them. Please switch to tidb backend then try again. | | | +----+-------------------------------------------------------------------------------------------------------+-------------+--------+
tidb lightning encountered error: [Lightning:PreCheck:ErrPreCheckFailed]tidb-lightning pre-check failed: source csv files contains header row but `mydumper.csv.header` is false, checked table is `test`.`t2`; found PiTR log streaming task(s): [pitr], local backend is not compatible with them. Please switch to tidb backend then try again.
检查 test.t2.0000000010000.csv,发现有表头ID [tidb@monitor 20250905]$ more test.t2.0000000010000.csv "id" 1 2 3
将mydumper.csv中的参数header修改为 true,重新导入 [mydumper.csv] header = true 由于tidb启用了pitr日志,故导入需要将tikv-importer参数backend = "local"设置为tidb found PiTR log streaming task(s): [pitr] [tidb@monitor ~]$ tiup tidb-lightning -config tidb-lightning.toml Starting component tidb-lightning: /home/tidb/.tiup/components/tidb-lightning/v8.5.3/tidb-lightning -config tidb-lightning.toml Verbose debug logs will be written to tidb-lightning.log
+---+----------------------------------------------+-------------+--------+ | # | CHECK ITEM | TYPE | PASSED | +---+----------------------------------------------+-------------+--------+ | 1 | Source data files size is proper | performance | true | +---+----------------------------------------------+-------------+--------+ | 2 | the checkpoints are valid | critical | true | +---+----------------------------------------------+-------------+--------+ | 3 | Cluster version check passed | critical | true | +---+----------------------------------------------+-------------+--------+ | 4 | Lightning has the correct storage permission | critical | true | +---+----------------------------------------------+-------------+--------+
tidb lightning exit successfully
(6) 验证 mysql> use test Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A
Database changed mysql> show tables; +----------------+ | Tables_in_test | +----------------+ | t | | t1 | | t2 | +----------------+ 3 rows in set (0.00 sec)
mysql> select * from t1; +------+--------+ | id | name | +------+--------+ | 1 | 张三 | | 2 | 陈明 | +------+--------+ 2 rows in set (0.00 sec)
(5) 导入 [tidb@monitor ~]$ tiup tidb-lightning -config tidb-lightning-sql.toml Starting component tidb-lightning: /home/tidb/.tiup/components/tidb-lightning/v8.5.3/tidb-lightning -config tidb-lightning-sql.toml Verbose debug logs will be written to tidb-lightning.log
+---+----------------------------------------------+-------------+--------+ | # | CHECK ITEM | TYPE | PASSED | +---+----------------------------------------------+-------------+--------+ | 1 | Source data files size is proper | performance | true | +---+----------------------------------------------+-------------+--------+ | 2 | the checkpoints are valid | critical | true | +---+----------------------------------------------+-------------+--------+ | 3 | Cluster version check passed | critical | true | +---+----------------------------------------------+-------------+--------+ | 4 | Lightning has the correct storage permission | critical | true | +---+----------------------------------------------+-------------+--------+
tidb lightning exit successfully
(6) 验证 mysql> use mydb Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A
Database changed mysql> show tables; +----------------+ | Tables_in_mydb | +----------------+ | t | | t1 | | t100 | | t2 | +----------------+ 4 rows in set (0.00 sec)
mysql> select * from t100; +------+--------+ | id | name | +------+--------+ | 1 | 张三 | | 2 | 陈明 | +------+--------+ 2 rows in set (0.00 sec)
(4) 导入 [tidb@monitor ~]$ tiup tidb-lightning -config tidb-lightning-sql-replace.toml Starting component tidb-lightning: /home/tidb/.tiup/components/tidb-lightning/v8.5.3/tidb-lightning -config tidb-lightning-sql-replace.toml Verbose debug logs will be written to tidb-lightning.log
+---+----------------------------------------------+-------------+--------+ | # | CHECK ITEM | TYPE | PASSED | +---+----------------------------------------------+-------------+--------+ | 1 | Source data files size is proper | performance | true | +---+----------------------------------------------+-------------+--------+ | 2 | the checkpoints are valid | critical | true | +---+----------------------------------------------+-------------+--------+ | 3 | Cluster version check passed | critical | true | +---+----------------------------------------------+-------------+--------+ | 4 | Lightning has the correct storage permission | critical | true | +---+----------------------------------------------+-------------+--------+
tidb lightning exit successfully
(5) 校验 mysql> use orcl Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A
Database changed mysql> mysql> show tables; +----------------+ | Tables_in_orcl | +----------------+ | t200 | +----------------+ 1 row in set (0.00 sec)
mysql> select * from t200; +------+--------+ | id | name | +------+--------+ | 1 | 张三 | | 2 | 陈明 | +------+--------+ 2 rows in set (0.01 sec)