hbase(main):0il:0>status
1 active master,0 backup masters, 1 servers,0 dead,4.0000 average load
hbase(main):012:0>version
1.2.1,r8d8a7107dc4ccbf36a92f64675dc60392f85c015,Wed Mar 30 11:19:21 CDT 2016
hbase(main):013:0>
create'table','column_famaly','column_famaly1','column_famaly2'
0 row(s) in 94.9160 seconds
hbase(main):014:0>list
TABLE
stu
table
test
3 row(s) in 0.0570 seconds
hbase(main):015:0> describe'table'
Table table is ENABLED
table
COLUMN FAMILIES DESCRIPTION
{NAME =>'coluran_famaly',DATA_BLOCK_ENCODING =>'NONE',BLOOMFILTER =>'ROW',REPLICATION_SCOPE=>'0',VERSIONS=>'1',COMPRESSION=>'NONE', MIN_VERSIONS =>'0',TTL=>'FOREVER',KEEP_DELETED_CELLS=>'FALSE',BLOCKSIZE=>'65536',IN_MEMORY
=>'false',BLOCKCACHE=>'true}
......
3 row(s) in 0.0430 seconds
hbase(main):016:0>alter'table',{NAME=>'column_famaly',METHOD=>'delete'}
Updating all regions with the new schema...
1/1 regions updated.
Done.
0 row(s) in 3.0220 seconds
hbase(main):020:0>disable'stu'
0 row(s) in 2.3150 seconds
hbase(main):021:0>drop'stu'
0 row(s) in 1.2820 seconds
hbase(main):024:0>exists'table'
Table table does exist
0 row(s) in 0.0280 seconds
hbase(main):025:0>is_enabled'table'
true
0 row(s) in 0.0150 seconds
hbase(main):031:0>put'emp','rw1','col_f1:name','tanggao'
0 row(s) in 0.0460 seconds
hbase(main):032:0>put'emp','rw1','col_f1:age','20'
0 row(s) in 0.0150 seconds
hbase(main):033:0>put'emp','rw1','col_f1:sex','boy'
0 row(s) in 0.0190 seconds
hbase(main):034:0> get 'emp','rw1'
COLUMN CELL
col_f1:age timestamp=1463055735107,value=20
col_f1:name timestamp=1463055709542,value=tanggao
col_f1:sex timestamp=1463055753395,value=boy
3 row(s) in 0.3200 seconds
hbase(main):035:0>get'emp','rw1','col_f1'
COLUMN CELL
col_f1:age timestamp=1463055735107,value=20
col_f1:name timestamp=1463055709542,value=tanggao col_f1:sex timestamp=1463055753395,value=boy
3 row(s) in 0.0270 seconds
hbase (main):037:0> put 'emp','rw1'col_f1:age','22'
0 row(s) in 0.0160 seconds
hbase(main):038:0>get 'emp','rw1','col_f1:age'
COLUMN CELL
col_f1:age timestamp=1463055893492,value=22
1 row(s) in 0.0190 seconds
hbase(main):039:0>get 'emp','rw1',{COLUMN=>'col_f1:age',TIMESTAMP=>1463055735107}
COLUMN CELL
col_f1:age timestamp=1463055735107,value=20
1 row(s) in 0.0340 seconds
hbase(main):040:0>get 'emp','rw1',{COLUMN=>'col_f1:age',TIMESTAMP=>1463055893492}
COLUMN CELL
col_f1:age timestamp=1463055893492,value=22
1 row(s) in 0.0140 seconds
hbase(main):041:0>scan 'emp'
ROW COLUMN+CELL
id column=col_f1:age,timestamp=1463055893492,value=2
id column=col_f1:name,timestamp=1463055709542,value=tanggao
id column=col_f1:sex,timestamp=1463055753395,value=boy
1 row(s) in 0.1520 seconds
hbase(main):042:0>delete 'emp','rw1','col_f1:age'
0 row(s) in 0.0200 seconds
hbase(main):043:0>get 'emp','rw1'
COLUMN CELL
col_f1:name timestamp=1463.055709542,value=tanggao col_f1:sex timestamp=1463055753395,value=boy
2 row(s) in 0.2430 seconds
hbase(main) :044:0>deleteall 'emp','rw1'
0 row(s) in 0.0550 seconds
hbase(main):045:0>count 'emp'
0 row(s) in 0.0450 seconds
hbase(main):007:0>truncate'emp'
Truncating 'emp' table(it may take a while);
-Disabling table...
-Truncating table...
0 row(s) in 4.1510 seconds
hbase(main):001:0> create 'scores','grade','course'
2. 按设计的表结构添加值
put'scores','Jim1','grade:'1'
put'scores','Jim','course:Chinese','90'
put'scores','Jim','course:math','85'
put'scores','Jim','course:english','85'
put'scores','Tom','grade:','2'
put'scores','Tom','course:Chinese','97'
put'scores','Tom','course:math','100'
put'scores','Tom','course:english','92'
hbase(main):012:0>get 'scores','Jim'
查看 scores 表中 Jim 行、course 列族中 math 列的值。hbase(main):012:0>get 'scores','Jim','course:math'
或者用以下代码。hbase(main):012:0>get 'scores','Jim',{COLUMN=>'course:math'}
4. 扫描所有数据hbase(main):012:0>scan 'scores'
上述命令会显示所有数据行,也就是 Tom 和 Jim 的所有课程的成绩,包括 chinese、math 和 english。scan'scores',{COLUMN=>'course:english',STARTROW=>Jim,ENDROW=Tom}
5. 添加新的列 为 Tom 添加 computing 课程的成绩。hbase(main):012:0>put'scores','Tom','course:computing','90'