原文链接:www.gbase.cn/community/p…
更多精彩内容尽在南大通用GBase技术社区,南大通用致力于成为用户最信赖的数据库产品供应商。
GBase 8a资源管理-高低优先级用户配置方法示例
使用管理员用户创建两个普通数据库用户
gccli -uroot -pxxxxxx -vvv -e"Create user high_user1";
gccli -uroot -pxxxxxx-vvv -e"Grant all on *.* to high_user1";
gccli -uroot -pxxxxxx-vvv -e"Create user lower_user1";
gccli -uroot -pxxxxxx-vvv -e"Grant all on *.* to lower_user1";
创建资源消费组并关联用户
CREATE CONSUMER GROUP group_high comment = 'users for high’;
CREATE CONSUMER GROUP group_low comment = 'users for low';
ALTER CONSUMER GROUP group_high add user group_high ;
ALTER CONSUMER GROUP group_low add user group_low ;
创建资源池语句
创建consumer group,关联user:
create consumer group group1 comment = 'g1';
alter consumer group group1 add user high_user1;
create consumer group group2 comment = 'g2';
alter consumer group group2 add user lower_user1;
创建静态池语句:
create resource pool static_pool0(
cpu_percent=100,
max_memory=10000,
max_temp_diskspace=100000,
max_disk_writeio=1000,
max_disk_readio=1000) TYPE static;
创建不同优先级动态池:
create resource pool pool_high(
priority=1,
cpu_percent=90,
max_memory=4000,
max_temp_diskspace=50000,
max_disk_writeio=600,
max_disk_readio=600,
max_activetask=200,
task_max_parallel_degree=100)
type dynamic base on static_pool0;
create resource pool pool_low(
priority=2,
cpu_percent=50,
max_memory=4000,
max_temp_diskspace=5000,
max_disk_writeio=200,
max_disk_readio=200,
max_activetask=200,
task_max_parallel_degree=100)
type dynamic base on static_pool0;
创建资源计划
CREATE RESOURCE PLAN resource_plan comment = 'resource plan';
创建资源指令计划
CREATE RESOURCE DIRECTIVE directive_high
(plan_name = 'resource_plan',
pool_name = 'pool_high',
group_name = 'group_high',
comment = 'select user resource usage ');
CREATE RESOURCE DIRECTIVE directive_low
(plan_name = 'resource_plan',
pool_name = 'pool_low',
group_name = 'group_low',
comment = 'process user resource usage ');
激活plan
SET GLOBAL active_resource_plan =resource_plan;
使用high_user1 和low_user1同时执行sql语句,记录sql执行时间
high_user1用户较low_user1用户先执行完。
原文链接:www.gbase.cn/community/p…
更多精彩内容尽在南大通用GBase技术社区,南大通用致力于成为用户最信赖的数据库产品供应商。