码迷,mamicode.com
首页 > 系统相关 > 详细

Hadoop之——Hbase Shell命令

时间:2015-06-12 01:03:21      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:hadoop   mapreduce   集群   hbase   

转载请注明出处:http://blog.csdn.net/l1028386804/article/details/46463503

HBASE Shell

进入Habse数据库终端:#$HBASE_HOME/bin/hbase shell

技术分享

创建表

>create‘users‘,‘user_id‘,‘address‘,‘info‘

表users,有三个列族user_id,address,info

列出全部表

>list

得到表的描述

>describe ‘users

创建表

>create‘users_tmp‘,‘user_id‘,‘address‘,‘info‘

删除表

>disable ‘users_tmp‘

>drop ‘users_tmp‘

添加记录

put ‘users‘,‘xiaoming‘,‘info:age‘,‘24‘;

put ‘users‘,‘xiaoming‘,‘info:birthday‘,‘1987-06-17‘;

put ‘users‘,‘xiaoming‘,‘info:company‘,‘alibaba‘;

put ‘users‘,‘xiaoming‘,‘address:contry‘,‘china‘;

put ‘users‘,‘xiaoming‘,‘address:province‘,‘zhejiang‘;

put ‘users‘,‘xiaoming‘,‘address:city‘,‘hangzhou‘;

put ‘users‘,‘zhangyifei‘,‘info:birthday‘,‘1987-4-17‘;

put ‘users‘,‘zhangyifei‘,‘info:favorite‘,‘movie‘;

put ‘users‘,‘zhangyifei‘,‘info:company‘,‘alibaba‘;

put ‘users‘,‘zhangyifei‘,‘address:contry‘,‘china‘;

put ‘users‘,‘zhangyifei‘,‘address:province‘,‘guangdong‘;

put ‘users‘,‘zhangyifei‘,‘address:city‘,‘jieyang‘;

put ‘users‘,‘zhangyifei‘,‘address:town‘,‘xianqiao‘;

获取一条记录

1.取得一个id的所有数据

>get ‘users‘,‘xiaoming‘

2.获取一个id,一个列族的所有数据

>get ‘users‘,‘xiaoming‘,‘info‘

3.获取一个id,一个列族中一个列的

所有数据

get ‘users‘,‘xiaoming‘,‘info:age‘

更新记录

>put ‘users‘,‘xiaoming‘,‘info:age‘ ,‘29‘

>get ‘users‘,‘xiaoming‘,‘info:age‘

>put ‘users‘,‘xiaoming‘,‘info:age‘ ,‘30‘

>get ‘users‘,‘xiaoming‘,‘info:age‘

获取单元格数据的版本数据

>get‘users‘,‘xiaoming‘,{COLUMN=>‘info:age‘,VERSIONS=>1}

>get‘users‘,‘xiaoming‘,{COLUMN=>‘info:age‘,VERSIONS=>2}

>get ‘users‘,‘xiaoming‘,{COLUMN=>‘info:age‘,VERSIONS=>3}

获取单元格数据的某个版本数据

〉get ‘users‘,‘xiaoming‘,{COLUMN=>‘info:age‘,TIMESTAMP=>1364874937056}

全表扫描

>scan ‘users‘

删除xiaoming值的‘info:age‘字段

>delete ‘users‘,‘xiaoming‘,‘info:age‘

>get ‘users‘,‘xiaoming‘

删除整行

>deleteall ‘users‘,‘xiaoming‘

统计表的行数

>count ‘users‘

清空表

>truncate‘users‘

Hadoop之——Hbase Shell命令

标签:hadoop   mapreduce   集群   hbase   

原文地址:http://blog.csdn.net/l1028386804/article/details/46463503

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!