Skip to content

Commit 0b655e1

Browse files
wangboGabriel39
authored andcommitted
[docs]Add doc for workload group/grant/show processlist (apache#925)
1 parent 9aa8a20 commit 0b655e1

File tree

10 files changed

+177
-1
lines changed

10 files changed

+177
-1
lines changed

docs/admin-manual/resource-admin/workload-group.md

+48
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,51 @@ ADMIN SET FRONTEND CONFIG ("enable_cpu_hard_limit" = "true");
197197

198198
If user expects to switch back from cpu hard limit to cpu soft limit, then they only need to set ```enable_cpu_hard_limit=false```.
199199
CPU Soft Limit property ```cpu_share``` will be filled with a valid value of 1024 by default(If the user has never set the cpu_share before), and users can adjust cpu_share based on the priority of Workload Group.
200+
201+
# Workload Group权限表
202+
You can view the Workload Groups that users or roles have access to through the Workload Group privilege table. Authorization related usage can refer to[grant statement](../../sql-manual/sql-statements/Account-Management-Statements/GRANT).
203+
204+
This table currently has row level permission control. Root or admin accounts can view all data, while non root/admin accounts can only see data from Workload Groups that they have access to。
205+
206+
Schema of Workload Group privilege table is as follow:
207+
```
208+
mysql [information_schema]>desc information_schema.workload_group_privileges;
209+
+---------------------+--------------+------+-------+---------+-------+
210+
| Field | Type | Null | Key | Default | Extra |
211+
+---------------------+--------------+------+-------+---------+-------+
212+
| GRANTEE | varchar(64) | Yes | false | NULL | |
213+
| WORKLOAD_GROUP_NAME | varchar(256) | Yes | false | NULL | |
214+
| PRIVILEGE_TYPE | varchar(64) | Yes | false | NULL | |
215+
| IS_GRANTABLE | varchar(3) | Yes | false | NULL | |
216+
+---------------------+--------------+------+-------+---------+-------+
217+
```
218+
219+
Column Description:
220+
1. grantee, user or role.
221+
2. workload_group_name, value is the name of Workload Group or '%', where '%' represents all Workload Group.
222+
3. privilege_type,type of privilege, at present, the value of this column is only Usage_priv。
223+
4. is_grantable,value is YES or NO, it means whether the user can grant access privilege of Workload Group to other user.Only root/admin user has grant privilege.
224+
225+
Basic usage:
226+
1. Search for Workload Group with authorized access based on username.
227+
```
228+
mysql [information_schema]>select * from workload_group_privileges where GRANTEE like '%test_wlg_user%';
229+
+---------------------+---------------------+----------------+--------------+
230+
| GRANTEE | WORKLOAD_GROUP_NAME | PRIVILEGE_TYPE | IS_GRANTABLE |
231+
+---------------------+---------------------+----------------+--------------+
232+
| 'test_wlg_user'@'%' | normal | Usage_priv | NO |
233+
| 'test_wlg_user'@'%' | test_group | Usage_priv | NO |
234+
+---------------------+---------------------+----------------+--------------+
235+
2 rows in set (0.04 sec)
236+
```
237+
238+
2. Search for user which has access privilege by Workload Group name.
239+
```
240+
mysql [information_schema]>select * from workload_group_privileges where WORKLOAD_GROUP_NAME='test_group';
241+
+---------------------+---------------------+----------------+--------------+
242+
| GRANTEE | WORKLOAD_GROUP_NAME | PRIVILEGE_TYPE | IS_GRANTABLE |
243+
+---------------------+---------------------+----------------+--------------+
244+
| 'test_wlg_user'@'%' | test_group | Usage_priv | NO |
245+
+---------------------+---------------------+----------------+--------------+
246+
1 row in set (0.03 sec)
247+
```

docs/sql-manual/sql-statements/Account-Management-Statements/REVOKE.md

+18
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,24 @@ role_list is the list of roles to be revoked, separated by commas. The specified
7676
REVOKE 'role1','role2' FROM 'jack'@'192.%';
7777
```
7878

79+
4. Revoke user jack usage privilege on 'g1';
80+
81+
```
82+
REVOKE USAGE_PRIV ON WORKLOAD GROUP 'g1' FROM 'jack'@'%';
83+
```
84+
85+
5. Revoke user jack usage privilege on all Workload Group;
86+
87+
```
88+
REVOKE USAGE_PRIV ON WORKLOAD GROUP '%' FROM 'jack'@'%';
89+
```
90+
91+
6. Revoke role test_role usage privilege on Workload Group 'g1';
92+
93+
```
94+
REVOKE USAGE_PRIV ON WORKLOAD GROUP 'g1' FROM 'test_role';
95+
```
96+
7997
### Keywords
8098

8199
REVOKE

docs/sql-manual/sql-statements/Show-Statements/SHOW-PROCESSLIST.md

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ SHOW PROCESSLIST
3434

3535
Display the running threads of the user. It should be noted that except the root user who can see all running threads, other users can only see their own running threads, and cannot see the running threads of other users.
3636

37+
Only display current connected FE's connection list by default, you can set session variable ```set show_all_fe_connection = true``` to show all FE's connection.
38+
3739
grammar:
3840

3941
```sql

i18n/zh-CN/docusaurus-plugin-content-docs/current/admin-manual/resource-admin/workload-group.md

+49-1
Original file line numberDiff line numberDiff line change
@@ -194,4 +194,52 @@ ADMIN SET FRONTEND CONFIG ("enable_cpu_hard_limit" = "true");
194194
```
195195

196196
如果用户期望从 CPU 的硬限切换回 CPU 的软限,那么只需要在 FE 修改 enable_cpu_hard_limit 的值为 false 即可。
197-
CPU 软限的属性 cpu_share 默认会填充一个有效值 1024(如果之前未指定 cpu_share 的值),用户可以根据 group 的优先级对 cpu_share 的值进行重新调整。
197+
CPU 软限的属性 cpu_share 默认会填充一个有效值 1024(如果之前未指定 cpu_share 的值),用户可以根据 group 的优先级对 cpu_share 的值进行重新调整。
198+
199+
# Workload Group权限表
200+
可以通过Workload Group权限表查看user或者role有权限访问的Workload Group,授权相关的用法可以参考[grant 语句](../../sql-manual/sql-statements/Account-Management-Statements/GRANT)
201+
202+
该表目前存在行级别的权限控制,root或者admin账户可以查看所有的数据,非root/admin账户只能看到自己有权限访问的Workload Group的数据。
203+
204+
Workload Group权限表结构如下:
205+
```
206+
mysql [information_schema]>desc information_schema.workload_group_privileges;
207+
+---------------------+--------------+------+-------+---------+-------+
208+
| Field | Type | Null | Key | Default | Extra |
209+
+---------------------+--------------+------+-------+---------+-------+
210+
| GRANTEE | varchar(64) | Yes | false | NULL | |
211+
| WORKLOAD_GROUP_NAME | varchar(256) | Yes | false | NULL | |
212+
| PRIVILEGE_TYPE | varchar(64) | Yes | false | NULL | |
213+
| IS_GRANTABLE | varchar(3) | Yes | false | NULL | |
214+
+---------------------+--------------+------+-------+---------+-------+
215+
```
216+
217+
字段说明:
218+
1. grantee,代表user或者role。
219+
2. workload_group_name,取值为Workload Group的名称或者%,%代表可以访问所有的Workload Group。
220+
3. privilege_type,权限的类型,目前该列的值只有Usage_priv。
221+
4. is_grantable,取值为YES或者NO,字段含义为是否可以给其他用户授予Workload Group的访问权限。目前只有root用户或者admin用户这个字段为YES,其他用户都为NO。
222+
223+
基本用法:
224+
1. 根据用户名查找有权限访问的Workload Group
225+
```
226+
mysql [information_schema]>select * from workload_group_privileges where GRANTEE like '%test_wlg_user%';
227+
+---------------------+---------------------+----------------+--------------+
228+
| GRANTEE | WORKLOAD_GROUP_NAME | PRIVILEGE_TYPE | IS_GRANTABLE |
229+
+---------------------+---------------------+----------------+--------------+
230+
| 'test_wlg_user'@'%' | normal | Usage_priv | NO |
231+
| 'test_wlg_user'@'%' | test_group | Usage_priv | NO |
232+
+---------------------+---------------------+----------------+--------------+
233+
2 rows in set (0.04 sec)
234+
```
235+
236+
2. 查看某个Workload Group可以有哪些用户访问
237+
```
238+
mysql [information_schema]>select * from workload_group_privileges where WORKLOAD_GROUP_NAME='test_group';
239+
+---------------------+---------------------+----------------+--------------+
240+
| GRANTEE | WORKLOAD_GROUP_NAME | PRIVILEGE_TYPE | IS_GRANTABLE |
241+
+---------------------+---------------------+----------------+--------------+
242+
| 'test_wlg_user'@'%' | test_group | Usage_priv | NO |
243+
+---------------------+---------------------+----------------+--------------+
244+
1 row in set (0.03 sec)
245+
```

i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/Account-Management-Statements/REVOKE.md

+18
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,24 @@ role_list 是需要撤销的角色列表,以逗号分隔,指定的角色必
7777
REVOKE 'role1','role2' FROM 'jack'@'192.%';
7878
```
7979

80+
4. 撤销用户jack使用Workload Group 'g1'的权限
81+
82+
```
83+
REVOKE USAGE_PRIV ON WORKLOAD GROUP 'g1' FROM 'jack'@'%';
84+
```
85+
86+
5. 撤销用户jack使用所有Workload Group的权限
87+
88+
```
89+
REVOKE USAGE_PRIV ON WORKLOAD GROUP '%' FROM 'jack'@'%';
90+
```
91+
92+
6. 撤销角色test_role使用Workload Group 'g1'的权限
93+
94+
```
95+
REVOKE USAGE_PRIV ON WORKLOAD GROUP 'g1' FROM 'test_role';
96+
```
97+
8098
### Keywords
8199

82100
REVOKE

i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/Show-Statements/SHOW-PROCESSLIST.md

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ SHOW PROCESSLIST
3434

3535
显示用户正在运行的线程,需要注意的是,除了 root 用户能看到所有正在运行的线程外,其他用户都只能看到自己正在运行的线程,看不到其它用户正在运行的线程
3636

37+
默认只限制当前连接的FE的连接列表,可以通过设置session变量```set show_all_fe_connection = true```来查看所有FE的连接
38+
3739
语法:
3840

3941
```sql

i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/Account-Management-Statements/REVOKE.md

+18
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,24 @@ role_list 是需要撤销的角色列表,以逗号分隔,指定的角色必
7777
REVOKE 'role1','role2' FROM 'jack'@'192.%';
7878
```
7979

80+
4. 撤销用户jack使用Workload Group 'g1'的权限
81+
82+
```
83+
REVOKE USAGE_PRIV ON WORKLOAD GROUP 'g1' FROM 'jack'@'%';
84+
```
85+
86+
5. 撤销用户jack使用所有Workload Group的权限
87+
88+
```
89+
REVOKE USAGE_PRIV ON WORKLOAD GROUP '%' FROM 'jack'@'%';
90+
```
91+
92+
6. 撤销角色test_role使用Workload Group 'g1'的权限
93+
94+
```
95+
REVOKE USAGE_PRIV ON WORKLOAD GROUP 'g1' FROM 'test_role';
96+
```
97+
8098
### Keywords
8199

82100
REVOKE

i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/Show-Statements/SHOW-PROCESSLIST.md

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ SHOW PROCESSLIST
3434

3535
显示用户正在运行的线程,需要注意的是,除了 root 用户能看到所有正在运行的线程外,其他用户都只能看到自己正在运行的线程,看不到其它用户正在运行的线程
3636

37+
默认只限制当前连接的FE的连接列表,可以通过设置session变量```set show_all_fe_connection = true```来查看所有FE的连接
38+
3739
语法:
3840

3941
```sql

versioned_docs/version-2.1/sql-manual/sql-statements/Account-Management-Statements/REVOKE.md

+18
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,24 @@ role_list is the list of roles to be revoked, separated by commas. The specified
7676
REVOKE 'role1','role2' FROM 'jack'@'192.%';
7777
```
7878

79+
4. Revoke user jack usage privilege on 'g1';
80+
81+
```
82+
REVOKE USAGE_PRIV ON WORKLOAD GROUP 'g1' FROM 'jack'@'%';
83+
```
84+
85+
5. Revoke user jack usage privilege on all Workload Group;
86+
87+
```
88+
REVOKE USAGE_PRIV ON WORKLOAD GROUP '%' FROM 'jack'@'%';
89+
```
90+
91+
6. Revoke role test_role usage privilege on Workload Group 'g1';
92+
93+
```
94+
REVOKE USAGE_PRIV ON WORKLOAD GROUP 'g1' FROM 'test_role';
95+
```
96+
7997
### Keywords
8098

8199
REVOKE

versioned_docs/version-2.1/sql-manual/sql-statements/Show-Statements/SHOW-PROCESSLIST.md

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ SHOW PROCESSLIST
3434

3535
Display the running threads of the user. It should be noted that except the root user who can see all running threads, other users can only see their own running threads, and cannot see the running threads of other users.
3636

37+
Only display current connected FE's connection list by default, you can set session variable ```set show_all_fe_connection = true``` to show all FE's connection.
38+
3739
grammar:
3840

3941
```sql

0 commit comments

Comments
 (0)