[root@node-01 hbase-1.2.0-cdh5.14.0]# hbase
Usage: hbase [<options>]<command>[<args>]
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
hbase shell
运行hbase 的客户端命令行
退出:exit
注意事项一
不支持SQL语句
不支持SQL语句
不支持SQL语句
命令不能用分号结尾
命令不能用分号结尾
命令不能用分号结尾
查看命令帮助文档
HBase Shell; enter ‘help’ for list of supported commands.
help
注意事项二
这个命令行如果写错了,删除不能直接按backspace按键
默认删除是向后删除
按住ctrl+backspace删除键可以向前删除(或者设置会话选项里的映射键,打两个√)
2、DDL
NameSpace的管理
Group name: namespace
Commands: alter_namespace, create_namespace, describe_namespace, drop_namespace, list_namespace, list_namespace_tables
put 'ns1:t1', 'r1', 'c1', 'value'
put 't1', 'r1', 'c1', 'value', ts1
测试
put 'student:stu','20200101_001','basic:name','laoda'
put 'student:stu','20200101_001','basic:age',18
put 'student:stu','20200101_001','basic:sex','male'
put 'student:stu','20200101_001','other:phone','110'
put 'student:stu','20200101_001','other:addr','shanghai'
put 'student:stu','20200103_002','basic:name','laoer'
put 'student:stu','20200103_002','basic:age',20
put 'student:stu','20200103_002','other:phone','119'
put 'student:stu','20200102_003','basic:name','laosan'
put 'student:stu','20200102_003','other:phone','120'
put 'student:stu','20200102_003','other:addr','beijing'
更新
put 'student:stu','20200103_002','basic:name','laosi'
scan 'student:stu',{VERSIONS=>10}
get:获取数据
功能:最多返回一个rowkey的所有数据
查询最快的方式
为什么:必须指定rowkey,rowkey是底层Hbase的索引
语法
get 'ns1:t1', 'r1'
get 'ns1:t1', 'r1','c1'
测试
get 'student:stu','20200103_002'
get 'student:stu','20200103_002','basic'
get 'student:stu','20200103_002','basic:name'