Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
8 changes: 6 additions & 2 deletions dm/dm-precheck.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,12 @@ tiup dmctl check-task ./task.yaml
* (必须)上游数据库的 dump 权限

- 检查是否有 INFORMATION_SCHEMA 和 dump 表的 SELECT 权限。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 检查是否有 INFORMATION_SCHEMA 和 dump 表的 SELECT 权限。
- 检查是否有 `INFORMATION_SCHEMA` 和 dump 表的 `SELECT` 权限。

- 如果 consistency=flush,将检查是否有 RELOAD 权限。
- 如果 consistency=flush/lock,将检查是否有 dump 表的 LOCK TABLES 权限。
- 如果 `consistency=flush`,将检查是否有 RELOAD 权限。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 如果 `consistency=flush`,将检查是否有 RELOAD 权限。
- 如果 `consistency=flush`,将检查是否有 `RELOAD` 权限。

- 如果 `consistency=lock`,将检查是否有 dump 表的 `LOCK TABLES` 权限。

> **注意:**
>
> `consistency=auto`(默认值)时,DM 会首先尝试执行 `FLUSH TABLES WITH READ LOCK`(FTWRL)。如果 FTWRL 不可用,DM 会回退使用 `LOCK TABLES`。这种回退在托管型 MySQL 服务中较为常见(例如 Amazon RDS、Aurora、ApsaraDB RDS for MySQL、Azure Database for MySQL 和 Google Cloud SQL),因为这些服务通常不允许执行 FTWRL。在这种情况下,运行时需要具备 `LOCK TABLES` 权限,但当前的 precheck 并不会验证该权限。完整的权限列表,请参见[上游数据库用户权限](/dm/dm-worker-intro.md#上游数据库用户权限)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> 当 `consistency=auto`(默认值)时,DM 会首先尝试执行 `FLUSH TABLES WITH READ LOCK`FTWRL。如果 FTWRL 不可用,DM 会回退使用 `LOCK TABLES`。这种回退在托管型 MySQL 服务中较为常见(例如 Amazon RDS、Aurora、ApsaraDB RDS for MySQL、Azure Database for MySQL 和 Google Cloud SQL),因为这些服务通常不允许执行 FTWRL。在这种情况下,运行时需要具备 `LOCK TABLES` 权限,但当前的 precheck 并不会验证该权限。完整的权限列表,请参见[上游数据库用户权限](/dm/dm-worker-intro.md#上游数据库用户权限)。
> 当 `consistency=auto`(默认值)时,DM 会首先尝试执行 `FLUSH TABLES WITH READ LOCK` (FTWRL)。如果 FTWRL 不可用,DM 会回退使用 `LOCK TABLES`。这种回退在托管型 MySQL 服务中较为常见(例如 Amazon RDS、Aurora、ApsaraDB RDS for MySQL、Azure Database for MySQL 和 Google Cloud SQL),因为这些服务通常不允许执行 FTWRL。在这种情况下,运行时需要具备 `LOCK TABLES` 权限,但当前的 precheck 并不会验证该权限。完整的权限列表,请参见[上游数据库用户权限](/dm/dm-worker-intro.md#上游数据库用户权限)。

* (必须)上游 MySQL 多实例分库分表的一致性

Expand Down
10 changes: 10 additions & 0 deletions dm/dm-worker-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ Binlog replication/sync 处理单元读取上游 MySQL/MariaDB 的 binlog event
| `REPLICATION SLAVE` | Global |
| `REPLICATION CLIENT` | Global |

> **注意:**
>
> 如果从托管型 MySQL 服务(例如 Amazon RDS、Aurora、ApsaraDB RDS for MySQL、Azure Database for MySQL 或 Google Cloud SQL)迁移数据,且该服务不允许执行 `FLUSH TABLES WITH READ LOCK`(FTWRL),还需要授予 `LOCK TABLES` 权限。使用默认的 `consistency=auto` 设置时,如果 FTWRL 不可用,DM 会回退到 `LOCK TABLES`。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> 如果从托管型 MySQL 服务(例如 Amazon RDS、Aurora、ApsaraDB RDS for MySQL、Azure Database for MySQL 或 Google Cloud SQL)迁移数据,且该服务不允许执行 `FLUSH TABLES WITH READ LOCK`FTWRL,还需要授予 `LOCK TABLES` 权限。使用默认的 `consistency=auto` 设置时,如果 FTWRL 不可用,DM 会回退到 `LOCK TABLES`
> 如果从托管型 MySQL 服务(例如 Amazon RDS、Aurora、ApsaraDB RDS for MySQL、Azure Database for MySQL 或 Google Cloud SQL)迁移数据,且该服务不允许执行 `FLUSH TABLES WITH READ LOCK` (FTWRL),还需要授予 `LOCK TABLES` 权限。使用默认的 `consistency=auto` 设置时,如果 FTWRL 不可用,DM 会回退到 `LOCK TABLES`


如果要迁移 `db1` 的数据到 TiDB,可执行如下的 `GRANT` 语句:

{{< copyable "sql" >}}
Expand All @@ -61,6 +65,12 @@ GRANT RELOAD,REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'your_user'@'your_w
GRANT SELECT ON db1.* TO 'your_user'@'your_wildcard_of_host';
```

如果从不允许执行 `FLUSH TABLES WITH READ LOCK`(FTWRL)的托管型 MySQL 服务迁移数据,还需要授予 `LOCK TABLES` 权限:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
如果从不允许执行 `FLUSH TABLES WITH READ LOCK`FTWRL的托管型 MySQL 服务迁移数据,还需要授予 `LOCK TABLES` 权限:
如果从不允许执行 `FLUSH TABLES WITH READ LOCK` (FTWRL) 的托管型 MySQL 服务迁移数据,还需要授予 `LOCK TABLES` 权限:


```sql
GRANT LOCK TABLES ON db1.* TO 'your_user'@'your_wildcard_of_host';
```

如果还要迁移其他数据库的数据到 TiDB,请确保已赋予这些库跟 `db1` 一样的权限。

### 下游数据库用户权限
Expand Down
8 changes: 8 additions & 0 deletions dm/quick-start-with-dm.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ aliases: ['/docs-cn/tidb-data-migration/dev/quick-start-with-dm/','/docs-cn/tidb
GRANT PROCESS, BACKUP_ADMIN, RELOAD, REPLICATION SLAVE, REPLICATION CLIENT, SELECT ON *.* TO 'tidb-dm'@'%';
```

> **注意:**
>
> 如果你的 MySQL 数据源是托管型 MySQL 服务(例如 Amazon RDS、Aurora、ApsaraDB RDS for MySQL、Azure Database for MySQL 或 Google Cloud SQL),还需要授予 `LOCK TABLES` 权限。更多信息,请参见[上游数据库用户权限](/dm/dm-worker-intro.md#上游数据库用户权限)。

4. 创建示例数据:

```sql
Expand Down Expand Up @@ -148,6 +152,10 @@ aliases: ['/docs-cn/tidb-data-migration/dev/quick-start-with-dm/','/docs-cn/tidb
GRANT PROCESS, BACKUP_ADMIN, RELOAD, REPLICATION SLAVE, REPLICATION CLIENT, SELECT ON *.* TO 'tidb-dm'@'%';
```

> **注意:**
>
> 如果你的 MySQL 数据源是托管型 MySQL 服务(例如 Amazon RDS、Aurora、ApsaraDB RDS for MySQL、Azure Database for MySQL 或 Google Cloud SQL),还需要授予 `LOCK TABLES` 权限。更多信息,请参见[上游数据库用户权限](/dm/dm-worker-intro.md#上游数据库用户权限)。

6. 创建示例数据:

```sql
Expand Down
Loading