[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
Run the client command line of hbase
Exit: exit
Note one
Does not support SQL statements
Does not support SQL statements
Does not support SQL statements
Command cannot end with a semicolon
Command cannot end with a semicolon
Command cannot end with a semicolon
View command help documentation
HBase Shell; enter ‘help’ for list of supported commands.
help
Note two
If this command line is written incorrectly, you cannot delete it directly by pressing the backspace button
The default deletion is to delete backwards
Hold down ctrl+backspace delete key to delete forward (or 设置会话选项里的映射键,打两个√)
2 、 DDL
NameSpace management
Group name: namespace
Commands: alter_namespace, create_namespace, describe_namespace, drop_namespace, list_namespace, list_namespace_tables
put: insert data/update data [similar to replace in mysql, insert if it does not exist, update if it exists]
Function: Insert a column for a row of the Hbase table
grammar
put 'ns1:t1', 'r1', 'c1', 'value'
put 't1', 'r1', 'c1', 'value', ts1
test
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'
Update
put 'student:stu','20200103_002','basic:name','laosi'
scan 'student:stu',{
VERSIONS=>10}
get: Get data
Function: Return all data of one rowkey at most
The fastest way to query
Why: rowkey must be specified, rowkey is the index of the underlying Hbase
grammar
get 'ns1:t1', 'r1'
get 'ns1:t1', 'r1','c1'
test
get 'student:stu','20200103_002'
get 'student:stu','20200103_002','basic'
get 'student:stu','20200103_002','basic:name'
delete: delete data
Function: delete a certain column or a certain version of the data