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所在的目录设置容量限制.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • HBase那些事 @(大数据工程学院)[HBase, Hadoop, 优化, HadoopChen, hbase]...
    分痴阅读 4,009评论 3 17
  • 1. HBase介绍,Hbase是什么? HBase -- Hadoop Database ,是一个高可靠、高性能...
    奉先阅读 3,785评论 1 36
  • 入门指南 1. 简介 Quickstart会让你启动和运行一个单节点单机HBase。 2. 快速启动 – 单点HB...
    和心数据阅读 4,765评论 1 41
  • Hbase架构与原理 HBase是一个分布式的、面向列的开源数据库,该技术来源于 Fay Chang所撰写的Goo...
    全能程序猿阅读 86,330评论 2 37
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,026评论 19 139