进入hbase/bin目录,执行./hbase shell 打开shell
-- 查看命令的帮助信息
hbase(main):018:0> help 'create'
Create table; pass table name, a dictionary of specifications per
column family, and optionally a dictionary of table configuration.
Dictionaries are described below in the GENERAL NOTES section.
Examples:
hbase> create 't1', {NAME => 'f1', VERSIONS => 5}
hbase> create 't1', {NAME => 'f1'}, {NAME => 'f2'}, {NAME => 'f3'}
hbase> # The above in shorthand would be the following:
hbase> create 't1', 'f1', 'f2', 'f3'
hbase> create 't1', {NAME => 'f1', VERSIONS => 1, TTL => 2592000, BLOCKCACHE => true}
hbase> create 't1', 'f1', {SPLITS => ['10', '20', '30', '40']}
hbase> create 't1', 'f1', {SPLITS_FILE => 'splits.txt'}
hbase> # Optionally pre-split the table into NUMREGIONS, using
hbase> # SPLITALGO ("HexStringSplit", "UniformSplit" or classname)
hbase> create 't1', 'f1', {NUMREGIONS => 15, SPLITALGO => 'HexStringSplit'}
-- 创建stu表,有name和contact两个列族
0 row(s) in 1.2090 seconds
-- 插入数据
0 row(s) in 0.0930 seconds
hbase(main):010:0> put 'stu','zhang san','name:last','san'
0 row(s) in 0.0750 seconds
hbase(main):011:0> put 'stu','zhang san','contact:tel','13000000000'
0 row(s) in 0.0790 seconds
hbase(main):012:0> put 'stu','zhang san','contact:email','z3@gmail.com'
0 row(s) in 0.0740 seconds
-- get查询
COLUMN CELL
contact:email timestamp=1355938162012, value=z3@gmail.com
contact:tel timestamp=1355938151070, value=13000000000
name:first timestamp=1355938132910, value=zhang
name:last timestamp=1355938142305, value=san
4 row(s) in 0.1320 seconds
hbase(main):014:0> scan 'stu'
ROW COLUMN+CELL
zhang san column=contact:email, timestamp=1355938162012, value=z3@gmail.com
zhang san column=contact:tel, timestamp=1355938151070, value=13000000000
zhang san column=name:first, timestamp=1355938132910, value=zhang
zhang san column=name:last, timestamp=1355938142305, value=san
1 row(s) in 0.1160 seconds
hbase(main):015:0> list
TABLE
stu
1 row(s) in 0.2420 seconds
-- disable表
0 row(s) in 2.2600 seconds
-- 删除表
0 row(s) in 1.2360 seconds
hbase(main):018:0>