HBase入门及实践

2019-02-12 13:44 

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wxs060524/article/details/80495106

关于HBase

[test@prod ~]$ hbase
Usage: hbase [] []
Options:
–config DIR Configuration direction to use. Default: ./conf
–hosts HOSTS Override the list in ‘regionservers’ file
–auth-as-server Authenticate to ZooKeeper using servers configuration

Commands:
Some commands take arguments. Pass no args or -h for usage.
shell Run the HBase shell
hbck Run the hbase ‘fsck’ tool
snapshot Create a new snapshot of a table
snapshotinfo Tool for dumping snapshot information
wal Write-ahead-log analyzer
hfile Store file analyzer
zkcli Run the ZooKeeper shell
upgrade Upgrade hbase
master Run an HBase HMaster node
regionserver Run an HBase HRegionServer node
zookeeper Run a Zookeeper server
rest Run an HBase REST server
thrift Run the HBase Thrift server
thrift2 Run the HBase Thrift2 server
clean Run the HBase clean up script
classpath Dump hbase CLASSPATH
mapredcp Dump CLASSPATH entries required by mapreduce
pe Run PerformanceEvaluation
ltt Run LoadTestTool
version Print the version
CLASSNAME Run the class named CLASSNAME

开始使用命令行

[test@prod80 ~]$ hbase shell
18/05/29 11:19:52 INFO Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.available
HBase Shell; enter ‘help’ for list of supported commands.
Type “exit” to leave the HBase Shell
Version 1.2.0-cdh5.14.2, rUnknown, Tue Mar 27 13:32:35 PDT 2018

查看全部表

hbase(main):001:0> list
TABLE
0 row(s) in 0.1770 seconds

=> []

create ‘表名称’,‘列名称1’,…,‘列名称n’

eg:建立一个表scores,有两个列族grad和courese。

hbase(main):004:0> `create 'order','id','type',SPLITS => ['1300','1310','1320','1520','1550','1560','1850','1860']`

插入数据

hbase(main):009:0> put 'scores','Tom','id:','5'
hbase(main):011:0> put 'scores','Tom','type:1','100'
hbase(main):012:0> put 'scores','Tom','type:2','100'

发表评论

您必须 登录 才能发表留言!