首页 > 系统服务 > 详细

HBase的Shell操作

时间:2016-02-26 23:30:35      阅读:258      评论:0      收藏:0      [点我收藏+]

1、进入命令行

bin/hbase shell

2、输入help 查看各种命令组。

命令是分组的,可以执行help ‘general‘查看general组的命令。

3、常用命令

--显示有哪些表
list 
--显示表的DDL信息
describe ‘表名‘
--创建表
create ‘table name‘,‘family name‘...  
create ‘table name‘,{NAME=>‘family name‘,VERSIONS=>‘5‘}
--删除表
--先关闭表
disable ‘table name‘
drop ‘table name‘ 
--判断表是否可用
is_enabled ‘table name‘
is_disabled ‘table name‘
--启用表
enable ‘table name‘
--插入数据
put ‘table name‘,‘row key‘,‘family:column‘,value
--同样语句可以修改值
put ‘table name‘,‘row key‘,‘family:column‘,newvalue
--扫描表
scan ‘table name‘
--查看多个版本的信息
scan ‘table name‘,{RAW=true,VERSIONS=>3}
--指定列族
scan ‘tt1‘,{COLUMN=‘f1‘}
--获取值
get ‘table name‘,‘row key‘,[{COLUMN=>‘COLUMN‘,TIMESTAMP=‘‘}]
--保存值的时候,指定时间戳
put ‘table name‘,‘row key‘,‘family:column‘,value,ts
--清空数据(disable->drop->create)
truncate ‘table name‘

 

*语句结尾不带分号

HBase的Shell操作

原文:http://www.cnblogs.com/hpuCode/p/5216004.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!