HBase多租户-Namespace Quota管理

在多租户的HBase环境中,通常给一个租户分配一个namespace,因此namespace的容量管理是多租户管理必不可少的一部分.目前namespace支持三种容量的管理,table的最大数目,region的最大数目和namespace占用的文件系统空间.本文给出了通过hbase shell和JAVA API两种方式设置namespace quota的方法.

Number-of-Tables Quotas和Number-of-Regions Quotas

设置namespace quota之前,必须要在hbase-site里加一项配置,否则不会生效.

hbase.quota.enable=true

hbase shell设置Quota

创建namespace时设置quota

create_namespace 'myns', {'hbase.namespace.quota.maxtables'=>'2'}

增加或修改namespace quota

alter_namespace 'myns', {METHOD => 'set', 'hbase.namespace.quota.maxregions' => '5'}

删除namespace quota

alter_namespace 'myns', {METHOD => 'unset', NAME => 'hbase.namespace.quota.maxtables'}

如果创建表的操作超过了maxregions阈值,HBase shell会给出错误提示:

hbase(main):001:0> create 'myns:t1','f1'

ERROR: The table myns:t1 is not allowed to have 1 regions. The total number of regions permitted is only 5, while current region count is 5. This may be transient, please retry later if there are any ongoing split operations in the namespace.

JAVA API设置Quota

connection = ConnectionFactory.createConnection(conf);
Admin admin = this.connection.getAdmin();
NamespaceDescriptor namespaceDescriptor = NamespaceDescriptor.create("myns").build();
namespaceDescriptor.setConfiguration(
        "hbase.namespace.quota.maxtables", "10");
namespaceDescriptor.setConfiguration(
        "hbase.namespace.quota.maxregions", "100");
admin.createNamespace(namespaceDescriptor);
admin.close();

注: 以上两种quota管理从HDP2.4开始就支持,更早之前的HDP版本没有调研是否支持.

Namespace Storage Quota

HDP2.6加入了新的feature,支持给namespace设置文件系统空间容量,并且提供了多种策略定义当容量超过阈值之后的行为. 具体命令可以参考 Hortonworks官方文档: HBase Quota Management

在此之前的版本,要想限制namespace占用的空间大小,只能利用hdfs给namespace所在的目录设置容量限制.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值