Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove no-schema config #9176

Merged
merged 4 commits into from
Apr 28, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions migrate-aurora-to-tidb.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ type = '$3'
{{< copyable "shell-regular" >}}

```shell
tiup tidb-lightning -config tidb-lightning.toml -d 's3://my-bucket/schema-backup?region=us-west-2' -no-schema=false
tiup tidb-lightning -config tidb-lightning.toml -d 's3://my-bucket/schema-backup?region=us-west-2'
```

2. 运行 `tidb-lightning`。如果直接在命令行中启动程序,可能会因为 `SIGHUP` 信号而退出,建议配合`nohup`或`screen`等工具,如:
Expand All @@ -140,7 +140,7 @@ type = '$3'
```shell
export AWS_ACCESS_KEY_ID=${access_key}
export AWS_SECRET_ACCESS_KEY=${secret_key}
nohup tiup tidb-lightning -config tidb-lightning.toml -no-schema=true > nohup.out 2>&1 &
nohup tiup tidb-lightning -config tidb-lightning.toml > nohup.out 2>&1 &
```

3. 导入开始后,可以采用以下任意方式查看进度:
Expand Down
2 changes: 1 addition & 1 deletion tidb-lightning/migrate-from-csv-using-tidb-lightning.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ TiDB Lightning 支持读取 CSV(逗号分隔值)的数据源,以及其他
CSV 文件是没有表结构的。要导入 TiDB,就必须为其提供表结构。可以通过以下任一方法实现:

* 创建包含 DDL 语句 `CREATE TABLE` 的文件 `db_name.table_name-schema.sql` 以及包含 `CREATE DATABASE` DDL 语句的文件 `db_name-schema-create.sql`。
* 首先在 TiDB 中直接创建空表,然后在 `tidb-lightning.toml` 中设置 `[mydumper] no-schema = true`
* TiDB 中手动创建

## 配置

Expand Down
5 changes: 1 addition & 4 deletions tidb-lightning/tidb-lightning-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,7 @@ batch-import-ratio = 0.75

# 本地源数据目录或外部存储 URL
data-source-dir = "/data/my_database"
# 如果 no-schema = true,那么 TiDB Lightning 假设目标 TiDB 集群上
# 已有表结构,并且不会执行 `CREATE TABLE` 语句。
no-schema = false

# 指定包含 `CREATE TABLE` 语句的表结构文件的字符集。只支持下列选项:
# - utf8mb4:表结构文件必须使用 UTF-8 编码,否则会报错。
# - gb18030:表结构文件必须使用 GB-18030 编码,否则会报错。
Expand Down Expand Up @@ -403,7 +401,6 @@ min-available-ratio = 0.05
| --tidb-status *port* | TiDB Server 的状态端口的(默认为 10080) | `tidb.status-port` |
| --tidb-user *user* | 连接到 TiDB 的用户名 | `tidb.user` |
| --tidb-password *password* | 连接到 TiDB 的密码,可为明文或 Base64 编码 | `tidb.password` |
| --no-schema | 忽略表结构文件,直接从 TiDB 中获取表结构信息 | `mydumper.no-schema` |
| --enable-checkpoint *bool* | 是否启用断点 (默认值为 true) | `checkpoint.enable` |
| --analyze *level* | 导入后分析表信息,可选值为 required、optional(默认值)、off | `post-restore.analyze` |
| --checksum *level* | 导入后比较校验和,可选值为 required(默认值)、optional、off | `post-restore.checksum` |
Expand Down
4 changes: 2 additions & 2 deletions tidb-lightning/tidb-lightning-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ ADMIN CHECKSUM TABLE `schema`.`table`;

## 我已经在下游创建好库和表了,TiDB Lightning 可以忽略建库建表操作吗?

可以。在配置文档中的 `[mydumper]` 部分将 `no-schema` 设置为 `true` 即可。`no-schema=true` 会默认下游已经创建好所需的数据库和表,如果没有创建,会报错。
自 v5.1 版本之后可以自动识别。低于 v5.1 版本需在配置文档中的 `[mydumper]` 部分将 `no-schema` 设置为 `true` 即可。`no-schema=true` 会默认下游已经创建好所需的数据库和表,如果没有创建,会报错。
ran-huang marked this conversation as resolved.
Show resolved Hide resolved

## 有些不合法的数据,能否通过关掉严格 SQL 模式 (Strict SQL Mode) 来导入?

Expand Down Expand Up @@ -297,7 +297,7 @@ tidb-lightning-ctl --config conf/tidb-lightning.toml --checkpoint-error-destroy=
**解决办法**:

1. 编辑数据源,保存为纯 UTF-8 或 GB-18030 的文件。
2. 手动在目标数量库创建所有的表,然后设置 `[mydumper] no-schema = true` 跳过创建表的步骤
2. 手动在目标数量库创建所有的表。
ran-huang marked this conversation as resolved.
Show resolved Hide resolved
3. 设置 `[mydumper] character-set = "binary"` 跳过这个检查。但是这样可能使数据库出现乱码。

## [sql2kv] sql encode error = [types:1292]invalid time format: '{1970 1 1 …}'
Expand Down