创建表
create 'emp','personal data','professional data'
插入数据
put 'emp','1','personal data:name','raju'
put 'emp','1','personal data:city','hyderabad'
put 'emp','1','professional data:designation','manager'
put 'emp','1','professional data:salary','50000'
put 'emp','2','personal data:city','chennai'
put 'emp','2','personal data:name','ravi'
put 'emp','2','professional data:designation', 'sr:engg'
put 'emp','2','professional data:salary', '30000'
put 'emp','3','personal data:city','delhi'
put 'emp','3','personal data:name','rajesh'
put 'emp','3','professional data:designation','jr:engg'
put 'emp','3','professional data:salary','25000'
更新表数据
put 'emp','1','personal data:city','China'
列出表
hbase(main):096:0> list
TABLE
emp
1 row(s) in 0.0080 seconds
=> ["emp"]
查询表
scan 'emp'
查询单行
hbase(main):070:0> get 'emp','1'
COLUMN CELL
personal data:city timestamp=1537926847871, value=China
personal data:name timestamp=1537926475641, value=raju
professional data:designation timestamp=1537926475698, value=manager
professional data:salary timestamp=1537926475711, value=50000
4 row(s) in 0.0130 seconds
查询单行单列
hbase(main):073:0> get 'emp','3',{COLUMN => 'personal data:city'}
COLUMN CELL
personal data:city timestamp=1537926475771, value=delhi
1 row(s) in 0.0160 seconds
删除单行
hbase(main):076:0> delete 'emp','1'
0 row(s) in 0.0330 seconds
hbase(main):077:0> scan 'emp'
ROW COLUMN+CELL
2 column=personal data:city, timestamp=1537926475723, value=chennai
2 column=personal data:name, timestamp=1537926475736, value=ravi
2 column=professional data:designation, timestamp=1537926475747, value=sr:engg
2 column=professional data:salary, timestamp=1537926475759, value=30000
3 column=personal data:city, timestamp=1537926475771, value=delhi
3 column=personal data:name, timestamp=1537926475791, value=rajesh
3 column=professional data:designation, timestamp=1537926475804, value=jr:engg
3 column=professional data:salary, timestamp=1537926478103, value=25000
2 row(s) in 0.0130 seconds
删除单行单列
hbase(main):080:0> delete 'emp','2','personal data:name'
0 row(s) in 0.0130 seconds
计数
hbase(main):082:0> count 'emp'
2 row(s) in 0.0240 seconds
=> 2
截断表
hbase(main):086:0> truncate 'emp'
Truncating 'emp' table (it may take a while):
- Disabling table...
- Truncating table...
0 row(s) in 3.9870 seconds
删除表
hbase(main):100:0* disable 'emp'
0 row(s) in 2.2610 seconds
hbase(main):101:0> drop 'emp'
0 row(s) in 1.2600 seconds
删除t开头表
hbase(main):091:0> drop_all 't.*'
table1
Drop the above 1 tables (y/n)?
y
0 tables successfully dropped
1 tables not dropped due to an exception: table1