HBase change split policy on an existing table
hbase(main)::> create 'test_table_region', 'username'
row(s) in 1.2150 seconds hbase(main)::> put 'test_table_region', '', 'username:nick' ,''
row(s) in 0.0050 seconds hbase(main)::> scan 'test_table_region'
ROW COLUMN+CELL
column=username:nick, timestamp=, value=
row(s) in 0.1370 seconds hbase(main)::> describe 'test_table_region'
DESCRIPTION ENABLED
{NAME => 'test_table_region', FAMILIES => [{NAME => 'username', DATA_BLOCK_ENCODING true
=> 'NONE', BLOOMFILTER => 'NONE', REPLICATION_SCOPE => '', VERSIONS => '', COMPRES
SION => 'NONE', MIN_VERSIONS => '', TTL => '', KEEP_DELETED_CELLS => 'fal
se', BLOCKSIZE => '', IN_MEMORY => 'false', ENCODE_ON_DISK => 'true', BLOCKCACH
E => 'true'}]}
row(s) in 0.4040 seconds hbase(main)::> disable 'test_table_region'
row(s) in 3.1710 seconds hbase(main)::> alter 'test_table_region', {METHOD => 'table_att', SPLIT_POLICY => 'org.apache.hadoop.hbase.regionserver.ConstantSizeRegionSplitPolicy', MAX_FILESIZE => ''}
Updating all regions with the new schema...
/ regions updated.
Done.
row(s) in 4.5130 seconds hbase(main)::> enable 'test_table_region'
row(s) in 6.0330 seconds hbase(main)::> describe 'test_table_region'
DESCRIPTION ENABLED
{NAME => 'test_table_region', SPLIT_POLICY => 'org.apache.hadoop.hbase.regionserver. true
ConstantSizeRegionSplitPolicy', MAX_FILESIZE => '', FAMILIES => [{NAME =>
'username', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'NONE', REPLICATION_SCOPE
=> '', COMPRESSION => 'NONE', VERSIONS => '', TTL => '', MIN_VERSIONS =>
'', KEEP_DELETED_CELLS => 'false', BLOCKSIZE => '', ENCODE_ON_DISK => 'true',
IN_MEMORY => 'false', BLOCKCACHE => 'true'}]}
row(s) in 0.4610 seconds
the alter split_policy does not work for hbase before version 0.94
we need to use java code to change the split policy of an existing table
protected void changeSplitPolicy(String tableName, Configuration conf) throws IOException, IllegalAccessException, InstantiationException {
HBaseAdmin admin = new HBaseAdmin(conf);
HTable hTable = new HTable(conf, tableName);
HTableDescriptor htd = hTable.getTableDescriptor();
HTableDescriptor tableDesc = new HTableDescriptor(htd);
tableDesc.setValue(HTableDescriptor.SPLIT_POLICY, ConstantSizeRegionSplitPolicy.class.getName());
tableDesc.setValue(HTableDescriptor.MAX_FILESIZE, "5000000000");
if(admin.isTableEnabled(tableName)) {
admin.disableTable(tableName);
}
admin.modifyTable(Bytes.toBytes(tableName), tableDesc);
hTable.close();
admin.close();
System.out.println("change split policy over");
}
HBase change split policy on an existing table的更多相关文章
- [XAF] How to use the Allow/Deny permissions policy in the existing project
https://www.devexpress.com/Support/Center/Question/Details/T418166 Clear [C#] using DevExpress.Persi ...
- 利用ClouderaManager启动HBase时,出现 master.TableNamespaceManager: Namespace table not found. Creating...
1.错误描述: 出现上述这个错误的原因是我之前已经安装了Cloudera Manager中的CDH,其中添加了所有的服务,当然也包含HBase.然后重新安装的时候,就会出现如下错误: Failed t ...
- [HBase]region split流程
1. 简介 HBase 的最小管理单位为region,region会按照region 分裂策略进行分裂. 基于CDH5.4.2 2. 总览
- Hbase实验:java创建和删除table
开启zookeeper.hadoop.hbase: 打开eclipse创一个java project,然后导入所需jar包: 写好java代码,运行create,然后去hbase shell里查看: ...
- [Hive - LanguageManual] Alter Table/Partition/Column
Alter Table/Partition/Column Alter Table Rename Table Alter Table Properties Alter Table Comment Add ...
- hive和hbase本质区别——hbase本质是OLTP的nosql DB,而hive是OLAP 底层是hdfs,需从已有数据库同步数据到hdfs;hive可以用hbase中的数据,通过hive表映射到hbase表
对于hbase当前noSql数据库的一种,最常见的应用场景就是采集的网页数据的存储,由于是key-value型数据库,可以再扩展到各种key-value应用场景,如日志信息的存储,对于内容信息不需要完 ...
- Hbase split的三种方式和split的过程
在Hbase中split是一个很重要的功能,Hbase是通过把数据分配到一定数量的region来达到负载均衡的.一个table会被分配到一个或多个region中,这些region会被分配到一个或者多个 ...
- HBase Split
Region Split请求是在Region MemStore Flush之后被触发的: boolean shouldCompact = region.flushcache(); // We just ...
- How Region Split works in Hbase
A region is decided to be split when store file size goes above hbase.hregion.max.filesize or accord ...
随机推荐
- Yocto开发笔记之《Tip-stdlib库函数strtod返回nan错误》(QQ交流群:519230208)
2015.04-imx_v2015.04_3.14.38_6ul_ga+g5d63276 (Jan 04 2016 - 18:07:08) FSL Community BSP : https://co ...
- Arcgis SDE10.1 和 Arcgis server10.1的授权文件license
把下面内容复制进空白文本文档,改名和后缀为sde.ecp即可. 3dengine,101,ecp.arcgis.engine,none,WEJDFAZAM5FBAZ8LN115 3dserver,10 ...
- Node.js入门笔记(4):文件系统(fs)
文件系统(FileSystem) 文件系统模块 对于文件无外乎创建修改添加. File System - 文件系统模块 - require('fs') fs模块是核心模块,需要使用require导入后 ...
- 配置SQL server远程连接(局域网)
具体步骤: 1) 2) 3) 4) 5) 6) 7) 最后为了防火墙有影响,直接把防火关了,测试连接通过在来设置防火墙.
- Linux/CentOS优化配置 汇总
[强烈要求做的]CentOS启用sudo,禁用root远程登录 Linux命令行修改IP.网关.DNS.主机名 的方法 Linux开机直接进入“命令行”模式 更改CentOS 6.x yum源为国内1 ...
- ReactiveCocoa源码拆分解析(五)
(整个关于ReactiveCocoa的代码工程可以在https://github.com/qianhongqiang/QHQReactive下载) 好多天没写东西了,今天继续.主要讲解RAC如何于UI ...
- 【安卓】aidl.exe E 10744 10584 io_delegate.cpp:102] Error while creating directories: Invalid argument
这几天在使用.aidl文件的时候eclipse的控制台总是爆出如下提示: aidl.exe E 10744 10584 io_delegate.cpp:102] Error while creatin ...
- SQLAchemy
SQLAlchemy是Python编程语言下的一款ORM框架,该框架建立在数据库API之上,使用关系对象映射进行数据库操作,简言之便是:将对象转换成SQL,然后使用数据API执行SQL并获取执行结果.
- MySQL 5.7 学习:新增配置参数
背景: 继上次介绍 初识 MySQL 5.6 新功能.参数完之后,刚好MySQL 5.7又GA了,在官方测试里看到,MySQL5.7在功能.性能.可用性.安全和监控上又提升了很高.现在看看和MySQL ...
- HDU 5102 The K-th Distance(模拟)
题意:输入一棵树,输出前k小的点对最短距离dis(i,j)的和. 模拟,官方题解说得很清楚了.不重复了. http://bestcoder.hdu.edu.cn/ 需要注意的是,复杂度要O(n+k), ...