1、TiDB Lightning 工具简介
TiDB Lightning 是一个专为 TiDB/TiKV 集群设计的快速数据恢复工具。它基于 TiDB 的 MyDumper 协议,
能够高效兼容 MySQL mysqldump/mydumper 导出的数据文件格式。通过多线程并发导入数据,
TiDB Lightning 极大地提高了数据恢复的速度,为用户提供了便捷、高效的数据恢复解决方案。
TiDB Lightning 工具全量数据高速导入到 TiDB 集群,速度可达到传统执行 SQL 导入方式的 3
倍以上、大约每小时 300 GB。
Lightning 有以下两个主要的使用场景:一是大量新数据的快速导入、二是全量数据的备份恢复
2.tidb lightning 的导入模式
TiDB Lightning目前支持两种导入方式,通过 backend 配置区分。不同的模式决定 TiDB Lightning
如何将数据导入到目标 TiDB 集群。
物理导入模式:TiDB Lightning 首先将数据编码成键值对并排序存储在本地临时目录,
然后将这些键值对上传到各个 TiKV 节点,最后调用TiKV Ingest接口将数据插入到TiKV的
RocksDB 中。如果用于初始化导入,请优先考虑使用物理导入模式,其拥有较高的导入速度。
物理导入模式对应的后端模式为 local。
逻辑导入模式:TiDB Lightning 先将数据编码成SQL,然后直接运行这些SQL语句进行数据导入。
如果需要导入的集群为生产环境线上集群,或需要导入的目标表中已包含有数据,则应使用逻辑导入模式。
逻辑导入模式对应的后端模式为tidb。
physical import mode(Local-backend)--面向的初始化导入(目标库,不能有相关表)
logical import mode(TiDB-backend) --直接连接TiDB数据库执行SQL
3.备份tidb
--备份tidb 的 test数据库
[tidb@mysql1 backup]$ mydumper -u root -p 'rootroot' -P 4000 -h 192.168.1.11 -B test -o /tidb/backup
--检查备份结果
[tidb@mysql1 backup]$ ll
total 64
-rw-rw-r-- 1 tidb tidb 146 Aug 17 19:25 metadata
-rw-rw-r-- 1 tidb tidb 186 Aug 17 19:25 test.my_test1-schema.sql
-rw-rw-r-- 1 tidb tidb 114 Aug 17 19:25 test.my_test1.sql
-rw-rw-r-- 1 tidb tidb 186 Aug 17 19:25 test.my_test2-schema.sql
-rw-rw-r-- 1 tidb tidb 248 Aug 17 19:25 test.my_test2.sql
-rw-rw-r-- 1 tidb tidb 66 Aug 17 19:25 test-schema-create.sql
4.删除数据,执行恢复
mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| my_test1 |
| my_test2 |
+----------------+
2 rows in set (0.00 sec)
mysql>
mysql> drop table my_test1;
Query OK, 0 rows affected (0.52 sec)
mysql> drop table my_test2;
Query OK, 0 rows affected (0.52 sec)
mysql> show tables;
Empty set (0.00 sec)
--执行恢复。
--后端模式为TIDB 的导入:
vi tidb-lightning.toml
[lightning]
# 日志
level = "info"
file = "tidb-lightning.log"
max-size = 128 # MB
max-days = 28
max-backups = 14
# 启动之前检查集群是否满足最低需求。
check-requirements = true
[mydumper]
# 本地源数据目录或外部存储 URI。
data-source-dir = "/tidb/backup/"
[tikv-importer]
# 导入模式配置,设为 tidb 即使用逻辑导入模式
backend = "tidb"
[tidb]
# 目标集群的信息。tidb-server 的地址,填一个即可。
host = "192.168.1.11"
port = 4000
user = "root"
# 设置连接 TiDB 的密码,可为明文或 Base64 编码。
password = "rootroot"
# tidb-lightning 引用了 TiDB 库,并生成产生一些日志。
# 设置 TiDB 库的日志等级。
log-level = "error"
status-port=10080
pd-addr = "192.168.1.11:2379" #未指定这个值,无法执行导入。
tiup tidb-lightning -config /tidb/backup/tidb-lightning.toml
[tidb@mysql1 backup]$ tiup tidb-lightning -config /tidb/backup/tidb-lightning.toml
Starting component `tidb-lightning`: /home/tidb/.tiup/components/tidb-lightning/v5.1.1/tidb-lightning -config /tidb/backup/tidb-lightning.toml
Verbose debug logs will be written to tidb-lightning.log
+---+-------------------------------------------------+-------------+--------+
| # | CHECK ITEM | TYPE | PASSED |
+---+-------------------------------------------------+-------------+--------+
| 1 | Cluster is available | critical | true |
+---+-------------------------------------------------+-------------+--------+
| 2 | Cluster has no other loads | performance | true |
+---+-------------------------------------------------+-------------+--------+
| 3 | Lightning has the correct storage permission | critical | true |
+---+-------------------------------------------------+-------------+--------+
| 4 | Cluster resources are rich for this import task | critical | true |
+---+-------------------------------------------------+-------------+--------+
| 5 | Source csv files size is proper | performance | true |
+---+-------------------------------------------------+-------------+--------+
| 6 | checkpoints are valid | critical | true |
+---+-------------------------------------------------+-------------+--------+
| 7 | table schemas are valid | critical | true |
+---+-------------------------------------------------+-------------+--------+
tidb lightning exit
--日志检查
[2024/08/17 19:27:46.431 +08:00] [WARN] [config.go:518] ["currently only per-task configuration can be applied, global configuration changes can only be made on startup"] ["global config changes
"="[lightning.level,lightning.file,lightning.max-size,lightning.max-days,lightning.max-backups,tidb.log-level]"]
[2024/08/17 19:27:46.447 +08:00] [INFO] [info.go:40] ["Welcome to TiDB-Lightning"] [release-version=v5.1.1] [git-hash=a34cc3d1d3aad1e31c423039f976b5ec90b82339] [git-branch=heads/refs/tags/v5.1.1
] [go-version=go1.16.4] [utc-build-time="2021-07-23 01:15:16"] [race-enabled=false]
[2024/08/17 19:27:46.447 +08:00] [INFO] [lightning.go:219] [cfg] [cfg="{\"id\":1723894066447245378,\"lightning\":{\"table-concurrency\":1,\"index-concurrency\":1,\"region-concurrency\":1,\"io-co
ncurrency\":5,\"check-requirements\":true,\"meta-schema-name\":\"\"},\"tidb\":{\"host\":\"192.168.1.11\",\"port\":4000,\"user\":\"root\",\"status-port\":10080,\"pd-addr\":\"192.168.1.11:2379\",\
"sql-mode\":\"ONLY_FULL_GROUP_BY,NO_AUTO_CREATE_USER\",\"tls\":\"false\",\"security\":{\"ca-path\":\"\",\"cert-path\":\"\",\"key-path\":\"\",\"redact-info-log\":false},\"max-allowed-packet\":671
08864,\"distsql-scan-concurrency\":15,\"build-stats-concurrency\":20,\"index-serial-scan-concurrency\":20,\"checksum-table-concurrency\":2},\"checkpoint\":{\"schema\":\"tidb_lightning_checkpoint
\",\"driver\":\"file\",\"enable\":true,\"keep-after-success\":false},\"mydumper\":{\"read-block-size\":65536,\"batch-size\":107374182400,\"batch-import-ratio\":0,\"data-source-dir\":\"file:///ti
db/backup\",\"character-set\":\"auto\",\"csv\":{\"separator\":\",\",\"delimiter\":\"\\\"\",\"null\":\"\\\\N\",\"header\":true,\"trim-last-separator\":false,\"not-null\":false,\"backslash-escape\
":true},\"max-region-size\":268435456,\"filter\":[\"*.*\",\"!mysql.*\",\"!sys.*\",\"!INFORMATION_SCHEMA.*\",\"!PERFORMANCE_SCHEMA.*\",\"!METRICS_SCHEMA.*\",\"!INSPECTION_SCHEMA.*\"],\"files\":nu
ll,\"no-schema\":false,\"case-sensitive\":false,\"strict-format\":false,\"default-file-rules\":true,\"ignore-data-columns\":null},\"tikv-importer\":{\"addr\":\"\",\"backend\":\"tidb\",\"on-dupli
cate\":\"replace\",\"max-kv-pairs\":4096,\"send-kv-pairs\":32768,\"region-split-size\":100663296,\"sorted-kv-dir\":\"\",\"disk-quota\":0,\"range-concurrency\":0,\"engine-mem-cache-size\":5368709
12,\"local-writer-mem-cache-size\":134217728},\"post-restore\":{\"checksum\":\"off\",\"analyze\":\"off\",\"level-1-compact\":false,\"post-process-at-last\":true,\"compact\":false},\"cron\":{\"sw
itch-mode\":\"5m0s\",\"log-progress\":\"5m0s\",\"check-disk-quota\":\"1m0s\"},\"routes\":null,\"security\":{\"ca-path\":\"\",\"cert-path\":\"\",\"key-path\":\"\",\"redact-info-log\":false},\"bla
ck-white-list\":{\"do-tables\":null,\"do-dbs\":null,\"ignore-tables\":null,\"ignore-dbs\":null}}"]
[2024/08/17 19:27:46.472 +08:00] [INFO] [lightning.go:282] ["load data source start"]
[2024/08/17 19:27:46.473 +08:00] [INFO] [loader.go:287] ["[loader] file is filtered by file router"] [path=metadata]
[2024/08/17 19:27:46.474 +08:00] [INFO] [loader.go:287] ["[loader] file is filtered by file router"] [path=tidb-lightning.log]
[2024/08/17 19:27:46.474 +08:00] [INFO] [loader.go:287] ["[loader] file is filtered by file router"] [path=tidb-lightning.toml]
[2024/08/17 19:27:46.474 +08:00] [INFO] [lightning.go:285] ["load data source completed"] [takeTime=2.255496ms] []
[2024/08/17 19:27:46.474 +08:00] [INFO] [checkpoints.go:979] ["open checkpoint file failed, going to create a new one"] [path=/tmp/tidb_lightning_checkpoint.pb] [error="open /tmp/tidb_lightning_
checkpoint.pb: no such file or directory"]
[2024/08/17 19:27:46.500 +08:00] [INFO] [restore.go:370] ["the whole procedure start"]
[2024/08/17 19:27:46.500 +08:00] [INFO] [tidb.go:336] ["skipping check requirements for tidb backend"]
[2024/08/17 19:27:46.533 +08:00] [INFO] [restore.go:672] ["restore all schema start"]
[2024/08/17 19:27:47.090 +08:00] [INFO] [restore.go:691] ["restore all schema completed"] [takeTime=557.397174ms] []
[2024/08/17 19:27:47.246 +08:00] [INFO] [restore.go:1151] ["restore all tables data start"]
[2024/08/17 19:27:47.247 +08:00] [INFO] [restore.go:1264] ["restore table start"] [table=`test`.`my_test1`]
[2024/08/17 19:27:47.248 +08:00] [INFO] [restore.go:2523] ["load engines and files start"] [table=`test`.`my_test1`]
[2024/08/17 19:27:47.248 +08:00] [INFO] [region.go:229] [makeTableRegions] [filesCount=1] [maxRegionSize=268435456] [RegionsCount=1] [cost=49.858µs]
[2024/08/17 19:27:47.248 +08:00] [INFO] [restore.go:2561] ["load engines and files completed"] [table=`test`.`my_test1`] [enginesCnt=2] [filesCnt=1] [takeTime=95.25µs] []
[2024/08/17 19:27:47.248 +08:00] [INFO] [backend.go:329] ["open engine"] [engineTag=`test`.`my_test1`:-1] [engineUUID=ca47a8f9-b2db-52e2-9014-07459f35fa18]
[2024/08/17 19:27:47.248 +08:00] [INFO] [restore.go:1632] ["import whole table start"] [table=`test`.`my_test1`]
[2024/08/17 19:27:47.249 +08:00] [INFO] [restore.go:1682] ["restore engine start"] [table=`test`.`my_test1`] [engineNumber=0]
[2024/08/17 19:27:47.249 +08:00] [INFO] [restore.go:1775] ["encode kv data and write start"] [table=`test`.`my_test1`] [engineNumber=0]
[2024/08/17 19:27:47.249 +08:00] [INFO] [backend.go:329] ["open engine"] [engineTag=`test`.`my_test1`:0] [engineUUID=804d333a-214f-57da-97fc-e4459b5cdd99]
[2024/08/17 19:27:47.250 +08:00] [INFO] [restore.go:3106] ["restore file start"] [table=`test`.`my_test1`] [engineNumber=0] [fileIndex=0] [path=test.my_test1.sql:0]
[2024/08/17 19:27:47.284 +08:00] [INFO] [restore.go:3116] ["restore file completed"] [table=`test`.`my_test1`] [engineNumber=0] [fileIndex=0] [path=test.my_test1.sql:0] [readDur=56.689µs] [encod
eDur=12.824µs] [deliverDur=33.393754ms] [checksum="{cksum=0,size=40,kvs=4}"] [takeTime=33.678686ms] []
[2024/08/17 19:27:47.284 +08:00] [INFO] [restore.go:1919] ["encode kv data and write completed"] [table=`test`.`my_test1`] [engineNumber=0] [read=2] [written=40] [takeTime=35.675111ms] []
[2024/08/17 19:27:47.284 +08:00] [INFO] [backend.go:410] ["engine close start"] [engineTag=`test`.`my_test1`:0] [engineUUID=804d333a-214f-57da-97fc-e4459b5cdd99]
[2024/08/17 19:27:47.284 +08:00] [INFO] [backend.go:412] ["engine close completed"] [engineTag=`test`.`my_test1`:0] [engineUUID=804d333a-214f-57da-97fc-e4459b5cdd99] [takeTime=1.147µs] []
[2024/08/17 19:27:47.284 +08:00] [INFO] [restore.go:1684] ["restore engine completed"] [table=`test`.`my_test1`] [engineNumber=0] [takeTime=35.788629ms] []
[2024/08/17 19:27:47.284 +08:00] [INFO] [restore.go:2718] ["import and cleanup engine start"] [engineTag=`test`.`my_test1`:0] [engineUUID=804d333a-214f-57da-97fc-e4459b5cdd99]
[2024/08/17 19:27:47.284 +08:00] [INFO] [backend.go:424] ["import start"] [engineTag=`test`.`my_test1`:0] [engineUUID=804d333a-214f-57da-97fc-e4459b5cdd99] [retryCnt=0]
[2024/08/17 19:27:47.284 +08:00] [INFO] [backend.go:427] ["import completed"] [engineTag=`test`.`my_test1`:0] [engineUUID=804d333a-214f-57da-97fc-e4459b5cdd99] [retryCnt=0] [takeTime=1.736µs] []
[2024/08/17 19:27:47.284 +08:00] [INFO] [backend.go:439] ["cleanup start"] [engineTag=`test`.`my_test1`:0] [engineUUID=804d333a-214f-57da-97fc-e4459b5cdd99]
[2024/08/17 19:27:47.284 +08:00] [INFO] [backend.go:441] ["cleanup completed"] [engineTag=`test`.`my_test1`:0] [engineUUID=804d333a-214f-57da-97fc-e4459b5cdd99] [takeTime=612ns] []
[2024/08/17 19:27:47.284 +08:00] [INFO] [restore.go:2726] ["import and cleanup engine completed"] [engineTag=`test`.`my_test1`:0] [engineUUID=804d333a-214f-57da-97fc-e4459b5cdd99] [takeTime=81.5
81µs] []
[2024/08/17 19:27:47.285 +08:00] [INFO] [restore.go:1703] ["import whole table completed"] [table=`test`.`my_test1`] [takeTime=36.048361ms] []
[2024/08/17 19:27:47.285 +08:00] [INFO] [backend.go:410] ["engine close start"] [engineTag=`test`.`my_test1`:-1] [engineUUID=ca47a8f9-b2db-52e2-9014-07459f35fa18]
[2024/08/17 19:27:47.285 +08:00] [INFO] [backend.go:412] ["engine close completed"] [engineTag=`test`.`my_test1`:-1] [engineUUID=ca47a8f9-b2db-52e2-9014-07459f35fa18] [takeTime=473ns] []
[2024/08/17 19:27:47.285 +08:00] [INFO] [restore.go:2718] ["import and cleanup engine start"] [engineTag=`test`.`my_test1`:-1] [engineUUID=ca47a8f9-b2db-52e2-9014-07459f35fa18]
[2024/08/17 19:27:47.285 +08:00] [INFO] [backend.go:424] ["import start"] [engineTag=`test`.`my_test1`:-1] [engineUUID=ca47a8f9-b2db-52e2-9014-07459f35fa18] [retryCnt=0]
[2024/08/17 19:27:47.285 +08:00] [INFO] [backend.go:427] ["import completed"] [engineTag=`test`.`my_test1`:-1] [engineUUID=ca47a8f9-b2db-52e2-9014-07459f35fa18] [retryCnt=0] [takeTime=1.026µs] [
]
[2024/08/17 19:27:47.285 +08:00] [INFO] [backend.go:439] ["cleanup start"] [engineTag=`test`.`my_test1`:-1] [engineUUID=ca47a8f9-b2db-52e2-9014-07459f35fa18]
[2024/08/17 19:27:47.285 +08:00] [INFO] [backend.go:441] ["cleanup completed"] [engineTag=`test`.`my_test1`:-1] [engineUUID=ca47a8f9-b2db-52e2-9014-07459f35fa18] [takeTime=4.927µs] []
[2024/08/17 19:27:47.285 +08:00] [INFO] [restore.go:2726] ["import and cleanup engine completed"] [engineTag=`test`.`my_test1`:-1] [engineUUID=ca47a8f9-b2db-52e2-9014-07459f35fa18] [takeTime=75.
319µs] []
[2024/08/17 19:27:47.285 +08:00] [INFO] [restore.go:2068] ["skip checksum"] [table=`test`.`my_test1`]
[2024/08/17 19:27:47.285 +08:00] [INFO] [restore.go:2118] ["skip analyze"] [table=`test`.`my_test1`]
[2024/08/17 19:27:47.285 +08:00] [INFO] [restore.go:1268] ["restore table completed"] [table=`test`.`my_test1`] [takeTime=38.113002ms] []
[2024/08/17 19:27:47.285 +08:00] [INFO] [restore.go:1264] ["restore table start"] [table=`test`.`my_test2`]
[2024/08/17 19:27:47.286 +08:00] [INFO] [restore.go:2523] ["load engines and files start"] [table=`test`.`my_test2`]
[2024/08/17 19:27:47.286 +08:00] [INFO] [region.go:229] [makeTableRegions] [filesCount=1] [maxRegionSize=268435456] [RegionsCount=1] [cost=32.677µs]
[2024/08/17 19:27:47.286 +08:00] [INFO] [restore.go:2561] ["load engines and files completed"] [table=`test`.`my_test2`] [enginesCnt=2] [filesCnt=1] [takeTime=62.759µs] []
[2024/08/17 19:27:47.286 +08:00] [INFO] [backend.go:329] ["open engine"] [engineTag=`test`.`my_test2`:-1] [engineUUID=bbcc6bf7-7296-5c8d-9a4a-63b96d209ccb]
[2024/08/17 19:27:47.286 +08:00] [INFO] [restore.go:1632] ["import whole table start"] [table=`test`.`my_test2`]
[2024/08/17 19:27:47.286 +08:00] [INFO] [restore.go:1682] ["restore engine start"] [table=`test`.`my_test2`] [engineNumber=0]
[2024/08/17 19:27:47.286 +08:00] [INFO] [restore.go:1775] ["encode kv data and write start"] [table=`test`.`my_test2`] [engineNumber=0]
[2024/08/17 19:27:47.286 +08:00] [INFO] [backend.go:329] ["open engine"] [engineTag=`test`.`my_test2`:0] [engineUUID=4f47e8bb-c21a-5b27-bbc5-5ddac877770c]
[2024/08/17 19:27:47.287 +08:00] [INFO] [restore.go:3106] ["restore file start"] [table=`test`.`my_test2`] [engineNumber=0] [fileIndex=0] [path=test.my_test2.sql:0]
[2024/08/17 19:27:47.299 +08:00] [INFO] [restore.go:3116] ["restore file completed"] [table=`test`.`my_test2`] [engineNumber=0] [fileIndex=0] [path=test.my_test2.sql:0] [readDur=34.672µs] [encod
eDur=6.98µs] [deliverDur=11.255562ms] [checksum="{cksum=0,size=162,kvs=10}"] [takeTime=11.399743ms] []
[2024/08/17 19:27:47.299 +08:00] [INFO] [restore.go:1919] ["encode kv data and write completed"] [table=`test`.`my_test2`] [engineNumber=0] [read=2] [written=162] [takeTime=12.9645ms] []
[2024/08/17 19:27:47.299 +08:00] [INFO] [backend.go:410] ["engine close start"] [engineTag=`test`.`my_test2`:0] [engineUUID=4f47e8bb-c21a-5b27-bbc5-5ddac877770c]
[2024/08/17 19:27:47.299 +08:00] [INFO] [backend.go:412] ["engine close completed"] [engineTag=`test`.`my_test2`:0] [engineUUID=4f47e8bb-c21a-5b27-bbc5-5ddac877770c] [takeTime=745ns] []
[2024/08/17 19:27:47.299 +08:00] [INFO] [restore.go:1684] ["restore engine completed"] [table=`test`.`my_test2`] [engineNumber=0] [takeTime=13.065758ms] []
[2024/08/17 19:27:47.299 +08:00] [INFO] [restore.go:2718] ["import and cleanup engine start"] [engineTag=`test`.`my_test2`:0] [engineUUID=4f47e8bb-c21a-5b27-bbc5-5ddac877770c]
[2024/08/17 19:27:47.299 +08:00] [INFO] [backend.go:424] ["import start"] [engineTag=`test`.`my_test2`:0] [engineUUID=4f47e8bb-c21a-5b27-bbc5-5ddac877770c] [retryCnt=0]
[2024/08/17 19:27:47.299 +08:00] [INFO] [backend.go:427] ["import completed"] [engineTag=`test`.`my_test2`:0] [engineUUID=4f47e8bb-c21a-5b27-bbc5-5ddac877770c] [retryCnt=0] [takeTime=896ns] []
[2024/08/17 19:27:47.299 +08:00] [INFO] [backend.go:439] ["cleanup start"] [engineTag=`test`.`my_test2`:0] [engineUUID=4f47e8bb-c21a-5b27-bbc5-5ddac877770c]
[2024/08/17 19:27:47.299 +08:00] [INFO] [backend.go:441] ["cleanup completed"] [engineTag=`test`.`my_test2`:0] [engineUUID=4f47e8bb-c21a-5b27-bbc5-5ddac877770c] [takeTime=441ns] []
[2024/08/17 19:27:47.299 +08:00] [INFO] [restore.go:2726] ["import and cleanup engine completed"] [engineTag=`test`.`my_test2`:0] [engineUUID=4f47e8bb-c21a-5b27-bbc5-5ddac877770c] [takeTime=46.7
32µs] []
[2024/08/17 19:27:47.300 +08:00] [INFO] [restore.go:1703] ["import whole table completed"] [table=`test`.`my_test2`] [takeTime=13.301205ms] []
[2024/08/17 19:27:47.300 +08:00] [INFO] [backend.go:410] ["engine close start"] [engineTag=`test`.`my_test2`:-1] [engineUUID=bbcc6bf7-7296-5c8d-9a4a-63b96d209ccb]
[2024/08/17 19:27:47.300 +08:00] [INFO] [backend.go:412] ["engine close completed"] [engineTag=`test`.`my_test2`:-1] [engineUUID=bbcc6bf7-7296-5c8d-9a4a-63b96d209ccb] [takeTime=536ns] []
[2024/08/17 19:27:47.300 +08:00] [INFO] [restore.go:2718] ["import and cleanup engine start"] [engineTag=`test`.`my_test2`:-1] [engineUUID=bbcc6bf7-7296-5c8d-9a4a-63b96d209ccb]
[2024/08/17 19:27:47.300 +08:00] [INFO] [backend.go:424] ["import start"] [engineTag=`test`.`my_test2`:-1] [engineUUID=bbcc6bf7-7296-5c8d-9a4a-63b96d209ccb] [retryCnt=0]
[2024/08/17 19:27:47.300 +08:00] [INFO] [backend.go:427] ["import completed"] [engineTag=`test`.`my_test2`:-1] [engineUUID=bbcc6bf7-7296-5c8d-9a4a-63b96d209ccb] [retryCnt=0] [takeTime=2.151µs] [
]
[2024/08/17 19:27:47.300 +08:00] [INFO] [backend.go:439] ["cleanup start"] [engineTag=`test`.`my_test2`:-1] [engineUUID=bbcc6bf7-7296-5c8d-9a4a-63b96d209ccb]
[2024/08/17 19:27:47.300 +08:00] [INFO] [backend.go:441] ["cleanup completed"] [engineTag=`test`.`my_test2`:-1] [engineUUID=bbcc6bf7-7296-5c8d-9a4a-63b96d209ccb] [takeTime=433ns] []
[2024/08/17 19:27:47.300 +08:00] [INFO] [restore.go:2726] ["import and cleanup engine completed"] [engineTag=`test`.`my_test2`:-1] [engineUUID=bbcc6bf7-7296-5c8d-9a4a-63b96d209ccb] [takeTime=92.
277µs] []
[2024/08/17 19:27:47.300 +08:00] [INFO] [restore.go:2068] ["skip checksum"] [table=`test`.`my_test2`]
[2024/08/17 19:27:47.300 +08:00] [INFO] [restore.go:2118] ["skip analyze"] [table=`test`.`my_test2`]
[2024/08/17 19:27:47.300 +08:00] [INFO] [restore.go:1268] ["restore table completed"] [table=`test`.`my_test2`] [takeTime=15.047384ms] []
[2024/08/17 19:27:47.300 +08:00] [INFO] [restore.go:1424] ["restore all tables data completed"] [takeTime=53.39725ms] []
[2024/08/17 19:27:47.300 +08:00] [INFO] [restore.go:1141] ["cancel periodic actions"] [do=false]
[2024/08/17 19:27:47.300 +08:00] [INFO] [restore.go:2146] ["skip full compaction"]
[2024/08/17 19:27:47.300 +08:00] [INFO] [restore.go:1040] ["everything imported, stopping periodic actions"]
[2024/08/17 19:27:47.309 +08:00] [INFO] [restore.go:2318] ["clean checkpoints start"] [keepAfterSuccess=false] [taskID=1723894066447245378]
[2024/08/17 19:27:47.309 +08:00] [INFO] [restore.go:2325] ["clean checkpoints completed"] [keepAfterSuccess=false] [taskID=1723894066447245378] [takeTime=52.951µs] []
[2024/08/17 19:27:47.309 +08:00] [INFO] [restore.go:400] ["the whole procedure completed"] [takeTime=808.383835ms] []
[2024/08/17 19:27:47.309 +08:00] [INFO] [main.go:94] ["tidb lightning exit"]
5.数据检查
mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| my_test1 |
| my_test2 |
+----------------+
2 rows in set (0.00 sec)
mysql> select * from my_test1;
+------+------+
| id | name |
+------+------+
| 1 | xsq1 |
| 2 | xsq2 |
| 3 | xsq3 |
| 4 | xsq4 |
+------+------+
4 rows in set (0.01 sec)
mysql> select * from my_test2;
+------+-------------+
| id | name |
+------+-------------+
| 1 | 薛双奇1 |
| 2 | 薛双奇2 |
| 3 | 薛双奇3 |
| 4 | 薛双奇4 |
| 5 | 薛双奇5 |
| 6 | 薛双奇6 |
| 7 | 薛双奇7 |
| 8 | 薛双奇8 |
| 9 | 薛双奇9 |
| 10 | 薛双奇10 |
+------+-------------+
10 rows in set (0.01 sec)