You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/12/02 07:08:35 UTC

[shardingsphere] branch master updated: Refining the documentation for migration permissions (#22585)

This is an automated email from the ASF dual-hosted git repository.

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 4f7af9f518c Refining the documentation for migration permissions (#22585)
4f7af9f518c is described below

commit 4f7af9f518c3b7a30fc147efc29a7fa2dfc8112e
Author: Xinze Guo <10...@users.noreply.github.com>
AuthorDate: Fri Dec 2 15:08:20 2022 +0800

    Refining the documentation for migration permissions (#22585)
---
 .../shardingsphere-proxy/migration/usage.cn.md     | 57 ++++++++++++++++++++++
 .../shardingsphere-proxy/migration/usage.en.md     | 52 ++++++++++++++++++++
 2 files changed, 109 insertions(+)

diff --git a/docs/document/content/user-manual/shardingsphere-proxy/migration/usage.cn.md b/docs/document/content/user-manual/shardingsphere-proxy/migration/usage.cn.md
index db5f7879c99..8b38f1ad8fd 100644
--- a/docs/document/content/user-manual/shardingsphere-proxy/migration/usage.cn.md
+++ b/docs/document/content/user-manual/shardingsphere-proxy/migration/usage.cn.md
@@ -62,6 +62,16 @@ SHOW GRANTS FOR 'user';
 +------------------------------------------------------------------------------+
 ```
 
+3. 赋予迁移时用到物理库的增删改查权限
+
+如果使用非超级管理员账号进行迁移,要求该账号在迁移时用到的物理库上,具备增删改查的权限。
+
+示例:
+
+```sql
+GRANT CREATE, DROP, SELECT, INSERT, UPDATE, DELETE, INDEX ON migration_ds_0.* TO `normal_user`@`%`;
+```
+
 ### 完整流程示例
 
 #### 前提条件
@@ -269,6 +279,27 @@ host replication repl_acct 0.0.0.0/0 md5
 
 详情请参见 [The pg_hba.conf File](https://www.postgresql.org/docs/9.6/auth-pg-hba-conf.html)。
 
+4. 赋予数据库和表的访问权限
+
+如果使用非超级管理员账号进行迁移,要求该账号在迁移时用到的数据库上,具备 CREATE,和 CONNECT 的权限。
+
+示例:
+
+```sql
+GRANT CREATE, CONNECT ON DATABASE migration_ds_0 TO normal_user;
+```
+
+还需要账号对迁移的表和 schema 具备访问权限,以 test schema 下的 t_order 表为例。
+
+```sql
+\c migration_ds_0
+
+GRANT USAGE ON SCHEMA test TO GROUP normal_user;
+GRANT SELECT ON TABLE test.t_order TO normal_user;
+```
+
+PostgreSQL 有 OWNER 的概念,如果是数据库,SCHEMA,表的 OWNER,则可以省略对应的授权步骤。
+
 ### 完整流程示例
 
 #### 前提条件
@@ -455,6 +486,32 @@ max_connections = 600
 ```
 host replication repl_acct 0.0.0.0/0 md5
 ```
+3. 赋予数据库和表的访问权限
+
+如果使用非超级管理员账号进行迁移,要求该账号在迁移时用到的数据库上,具备 CREATE,和 CONNECT 的权限。
+
+示例:
+
+```sql
+GRANT CREATE, CONNECT ON DATABASE migration_ds_0 TO normal_user;
+```
+
+还需要账号对迁移的表和 schema 具备访问权限,以 test schema 下的 t_order 表为例。
+
+```sql
+\c migration_ds_0
+
+GRANT USAGE ON SCHEMA test TO GROUP normal_user;
+GRANT SELECT ON TABLE test.t_order TO normal_user;
+```
+
+openGauss 有 OWNER 的概念,如果是数据库,SCHEMA,表的 OWNER,则可以省略对应的授权步骤。
+
+openGauss 因为安全原因,不允许普通客户在 public 模式下操作。所以如果迁移的表在 public 模式下,需要额外授权。
+
+```sql
+GRANT ALL PRIVILEGES TO normal_user;
+```
 
 详情请参见 [Configuring Client Access Authentication](https://opengauss.org/en/docs/2.0.1/docs/Developerguide/configuring-client-access-authentication.html) 和 [Example: Logic Replication Code](https://opengauss.org/en/docs/2.0.1/docs/Developerguide/example-logic-replication-code.html)。
 
diff --git a/docs/document/content/user-manual/shardingsphere-proxy/migration/usage.en.md b/docs/document/content/user-manual/shardingsphere-proxy/migration/usage.en.md
index 0720067db5d..315eebf6b62 100644
--- a/docs/document/content/user-manual/shardingsphere-proxy/migration/usage.en.md
+++ b/docs/document/content/user-manual/shardingsphere-proxy/migration/usage.en.md
@@ -58,6 +58,14 @@ Result sample:
 +------------------------------------------------------------------------------+
 ```
 
+3. Grant insert, select, update and delete permissions to the physical library used in the migration
+
+If you use a non-super admin account for migration, you need to make sure that the account has the permission to insert, select, update and delete on the physical library used for migration.
+
+```sql
+GRANT CREATE, DROP, SELECT, INSERT, UPDATE, DELETE, INDEX ON migration_ds_0.* TO `normal_user`@`%`;
+```
+
 ### Complete procedure example
 
 #### Prerequisite
@@ -263,6 +271,25 @@ host replication repl_acct 0.0.0.0/0 md5
 
 Please refer to [The pg_hba.conf File](https://www.postgresql.org/docs/9.6/auth-pg-hba-conf.html) for details.
 
+4. Grant access to databases and tables 
+
+If you are using a non-super admin account for migration, you need to GRANT CREATE and CONNECT privileges on the database used for migration.
+
+```sql
+GRANT CREATE, CONNECT ON DATABASE migration_ds_0 TO normal_user;
+```
+
+The account also need to have access to the migrated tables and schema, take the t_order table under test schema as an example. 
+
+```sql
+\c migration_ds_0
+
+GRANT USAGE ON SCHEMA test TO GROUP normal_user;
+GRANT SELECT ON TABLE test.t_order TO normal_user;
+```
+
+PostgreSQL has the concept of OWNER, and if the account is the OWNER of a database, SCHEMA, or table, the relevant steps can be omitted.
+
 ### Complete procedure example
 
 #### Prerequisite
@@ -453,6 +480,31 @@ host replication repl_acct 0.0.0.0/0 md5
 
 Please refer to [Configuring Client Access Authentication](https://opengauss.org/en/docs/2.0.1/docs/Developerguide/configuring-client-access-authentication.html) and [Example: Logic Replication Code](https://opengauss.org/en/docs/2.0.1/docs/Developerguide/example-logic-replication-code.html) for details.
 
+3. Grant access to databases and tables 
+
+If you are using a non-super admin account for migration, you need to GRANT CREATE and CONNECT privileges on the database used for migration.
+
+```sql
+GRANT CREATE, CONNECT ON DATABASE migration_ds_0 TO normal_user;
+```
+
+The account also need to have access to the migrated tables and schema, take the t_order table under test schema as an example. 
+
+```sql
+\c migration_ds_0
+
+GRANT USAGE ON SCHEMA test TO GROUP normal_user;
+GRANT SELECT ON TABLE test.t_order TO normal_user;
+```
+
+openGauss has the concept of OWNER, and if the account is the OWNER of a database, SCHEMA, or table, the relevant steps can be omitted.
+
+openGauss does not allow normal accounts to operate in public mode for security reasons. So if the migrated table is in public mode, you need to authorize additional.
+
+```sql
+GRANT ALL PRIVILEGES TO normal_user;
+```
+
 ### Complete procedure example
 
 #### Prerequisite