-
Notifications
You must be signed in to change notification settings - Fork 1.2k
dm: add LOCK TABLES privilege note for managed MySQL sources #21467
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -67,8 +67,12 @@ tiup dmctl check-task ./task.yaml | |||||
| * (必须)上游数据库的 dump 权限 | ||||||
|
|
||||||
| - 检查是否有 INFORMATION_SCHEMA 和 dump 表的 SELECT 权限。 | ||||||
| - 如果 consistency=flush,将检查是否有 RELOAD 权限。 | ||||||
| - 如果 consistency=flush/lock,将检查是否有 dump 表的 LOCK TABLES 权限。 | ||||||
| - 如果 `consistency=flush`,将检查是否有 RELOAD 权限。 | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| - 如果 `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#上游数据库用户权限)。 | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| * (必须)上游 MySQL 多实例分库分表的一致性 | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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`。 | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| 如果要迁移 `db1` 的数据到 TiDB,可执行如下的 `GRANT` 语句: | ||||||
|
|
||||||
| {{< copyable "sql" >}} | ||||||
|
|
@@ -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` 权限: | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| ```sql | ||||||
| GRANT LOCK TABLES ON db1.* TO 'your_user'@'your_wildcard_of_host'; | ||||||
| ``` | ||||||
|
|
||||||
| 如果还要迁移其他数据库的数据到 TiDB,请确保已赋予这些库跟 `db1` 一样的权限。 | ||||||
|
|
||||||
| ### 下游数据库用户权限 | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.