hbase shell命令注意事项
来源:互联网 发布:淘宝连衣裙店铺 编辑:程序博客网 时间:2024/05/16 12:59
hbase 的shell命令,创建表时,常常用的是简写的写法:如下
create 't1','c1','c2'
以上代表创建t1表,有c1,c2两个列族,但是这种写法,其他比如版本数,是否压缩等其他属性,则是默认配置。不能手动配置属性,如果配置的话,会报错unknown配置的属性!
若想具体设置,就要具体写完整的建表语句。比如
想创建一个表,版本数为2,使用snappy压缩,则要如下写命令:
create 't3',{NAME=>'c1',VERSIONS=>2,COMPRESSION=>'snappy'},{NAME=>'c2',VERSIONS=>3},SPLITS=>['0','1','2','3']
以上创建了t3表,第一个列族c1,版本号为2,压缩算法为 'snappy',第二个列族为c2,版本号为3,不使用压缩算法,整个表被预分区
随便desc一个表,出现的那些属性都可以这样来配置
使用api来创建使用snappy压缩算法的表:
@Test
public void createTable() throws Exception {
// 创建表管理类
HBaseAdmin admin = new HBaseAdmin(config); // hbase表管理
// 创建表描述类
TableName tableName = TableName.valueOf("t3"); // 表名称
HTableDescriptor desc = new HTableDescriptor(tableName);
// 创建列族的描述类
HColumnDescriptor family = new HColumnDescriptor("info"); // 列族
family.setCompressionType(Algorithm.SNAPPY);
// 将列族添加到表中
desc.addFamily(family);
//HColumnDescriptor family2 = new HColumnDescriptor("info2"); // 列族
// 将列族添加到表中
//desc.addFamily(family2);
// 创建表
admin.createTable(desc); // 创建表
}
阅读全文
0 0
- hbase shell命令注意事项
- hbase--HBase 常用Shell命令
- HBASE-hbase shell基础命令
- hbase shell命令
- hbase shell命令扩展
- hbase shell 基本命令
- HBase Shell基本命令
- hbase shell命令
- Hbase Shell 命令
- hbase 基本shell命令
- hbase的shell命令
- hbase shell 命令一
- HBase shell命令操作
- HBase 常用Shell 命令
- Hbase shell 命令详解
- Hbase shell命令
- Hbase shell 命令
- hbase shell 命令
- Lua和C++交互总结(很详细)
- Firefly-RK3288技术简报:代码和固件更新(2017/09/04)
- LoadRunner11安装+破解 笔记
- 日期转换
- myeclipse 2016 检出maven项目 部署启动项目
- hbase shell命令注意事项
- ESXI5.5虚拟机还原快照数据恢复处理办法
- linux curses图形库中光标移动程序实例
- Table表格导出为Excel、csv、txt、sql、json、xml、Word格式
- Elastic-Job-Lite 分析( 作业配置)
- 移动前端开发之viewport的深入理解
- HDU 1221 Rectangle and Circle(判定圆与矩形是否相交)
- 2017-09-08 LeetCode_009 Palindrome Number
- vue-cli#2.0项目结构分析