TiDB Lightning 命令行参数

你可以使用配置文件或命令行配置 TiDB Lightning。本文主要介绍 TiDB Lightning 的命令行参数。

命令行参数

tidb-lightning

使用 tidb-lightning 可以对下列参数进行配置:

参数描述对应配置项
--config filefile 读取全局设置。如果没有指定则使用默认设置。
-V输出程序的版本
-d directory读取数据的本地目录或外部存储服务的 URI 格式mydumper.data-source-dir
-L level日志的等级: debug、info、warn、error 或 fatal (默认为 info)lightning.log-level
-f rule表库过滤的规则 (可多次指定)mydumper.filter
--backend backend选择导入的模式:local物理导入模式tidb逻辑导入模式tikv-importer.backend
--log-file file日志文件路径(默认值为 /tmp/lightning.log.{timestamp},设置为 '-' 表示日志输出到终端)lightning.log-file
--status-addr ip:portTiDB Lightning 服务器的监听地址lightning.status-port
--pd-urls host1:port1,host2:port2,...,hostn:portnPD endpoint 的地址。从 v7.6.0 开始支持设置多个地址。tidb.pd-addr
--tidb-host hostTiDB Server 的 hosttidb.host
--tidb-port portTiDB Server 的端口(默认为 4000)tidb.port
--tidb-status portTiDB Server 的状态端口的(默认为 10080)tidb.status-port
--tidb-user user连接到 TiDB 的用户名tidb.user
--tidb-password password连接到 TiDB 的密码,可为明文或 Base64 编码tidb.password
--enable-checkpoint bool是否启用断点 (默认值为 true)checkpoint.enable
--analyze level导入后分析表信息,可选值为 required、optional(默认值)、offpost-restore.analyze
--checksum level导入后比较校验和,可选值为 required(默认值)、optional、offpost-restore.checksum
--check-requirements bool任务开始之前检查集群版本兼容性,以及运行过程中检查 TiKV 的可用存储空间是否大于 10%(默认值为 true)lightning.check-requirements
--ca fileTLS 连接的 CA 证书路径security.ca-path
--cert fileTLS 连接的证书路径security.cert-path
--key fileTLS 连接的私钥路径security.key-path
--server-mode在服务器模式下启动 TiDB Lightninglightning.server-mode

如果同时对命令行参数和配置文件中的对应参数进行更改,命令行参数将优先生效。例如,在 cfg.toml 文件中,不管对日志等级做出什么修改,运行 ./tidb-lightning -L debug --config cfg.toml 命令总是将日志级别设置为 “debug”。

tidb-lightning-ctl

所有 tidb-lightning 的参数也适用于 tidb-lightning-ctl。此外,使用 tidb-lightning-ctl 还可以对下列参数进行配置:

参数描述
--compact执行 full compact
--switch-mode mode将每个 TiKV Store 切换到指定模式(normal 或 import)
--fetch-mode打印每个 TiKV Store 的当前模式
--import-engine uuid将 TiKV Importer 上关闭的引擎文件导入到 TiKV 集群
--cleanup-engine uuid删除 TiKV Importer 上的引擎文件
--checkpoint-dump folder将当前的断点以 CSV 格式存储到文件夹中
--checkpoint-error-destroy tablename删除断点,如果报错则删除该表
--checkpoint-error-ignore tablename忽略指定表中断点的报错
--checkpoint-remove tablename无条件删除表的断点

tablename 必须是`db`.`tbl` 中的限定表名(包括反引号),或关键词 all

文档内容是否有帮助?

下载 PDF文档反馈社区交流修改本文
产品
TiDB
TiDB Cloud
© 2024 PingCAP. All Rights Reserved.
Privacy Policy.