Hadoop教程

Hadoop之——Hbase Shell命令

本文主要是介绍Hadoop之——Hbase Shell命令,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

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命令的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!