HBase 建表新增数据记录 - lovebeauty

时间:2024-03-01 18:21:24

HBase 建表新增数据记录

login as: root
root@192.168.12.23\'s password: *********
Last login: Wed Aug 20 00:41:17 2014 from 192.168.12.67
[root@testHostName1 ~]# create \'testTable\',\'testColumn\'
-bash: create: command not found
[root@testHostName1 ~]# hbase shell
HBase Shell; enter \'help<RETURN>\' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.94.7, r1471806, Wed Apr 24 18:44:36 PDT 2013

hbase(main):001:0> create \'testTable\',\'testColumn\'
0 row(s) in 2.1450 seconds

hbase(main):002:0> put \'testTable\',\'row1\',\'testColumn:a\',\'value1\'
0 row(s) in 0.1360 seconds

hbase(main):003:0> put \'testTable\',\'row2\',\'testColumn:b\',\'value2\'
0 row(s) in 0.0270 seconds

hbase(main):004:0> put \'testTable\',\'row3\',\'testColumn:c\',\'value3\'
0 row(s) in 0.0210 seconds

hbase(main):005:0> scan \'testTable\'
ROW                          COLUMN+CELL
 row1                        column=testColumn:a, timestamp=1408526740391, value=value1
 row2                        column=testColumn:b, timestamp=1408526771900, value=value2
 row3                        column=testColumn:c, timestamp=1408526783253, value=value3
3 row(s) in 0.0870 seconds
hbase(main):008:0> get \'testTable\',\'row1\'
COLUMN      CELL
cf:a        timestamp=1288380727188, value=value1
1 row(s) in 0.0400 seconds

disable 再 drop 这张表,可以清除你刚刚的操作
hbase(main):012:0> disable \'testTable\'
0 row(s) in 1.0930 seconds
hbase(main):013:0> drop \'test\'
0 row(s) in 0.0770 seconds 

关闭shell
hbase(main):014:0> exit