start up:
1 , start zk zkServer.sh start
2 , start HDFS start-dfs.sh
3 , start hbase Services Start-hbase . SH
(If you want to start being given the kill QuorumPeerMain process , restart )
4 start the client: HBase shell
Time must be synchronized, or will an error
TIMERANGE => [xxxxx, xxxxx] array timestamp range range
TIMESTAMP => xxxxx timestamp singular stamp flag
xy02:16010
xy02:16010
Hbase no concept of the library, is no pattern, but there is a namespace ( namespace equivalent library) and the concept of group (equivalent table)
Hbase default there are two groups : Deflult and Hbase
list display hbase tables
---------------------------------------------------------------------------------------------------------------------------------
increase
create 'user', 'info' , 'data' create a user table that contains info , Data two columns group , default (default)
create 'ns1: user', ' info', 'data' in NSl ( namesqpce built lower) User
create 'user1',{NAME=>'info',BLOOMFILTER => 'ROWCOL',VERSIONS => '2'}
alter 'user1',{NAME=>'data',BLOOMFILTER => 'ROWCOL',VERSIONS => '2'}
( There is update changes, if any, new, you can use alter new data row cluster )
create 'user2', 'f1' , SPLITS => [ '10', '20', '30', '40'] - allocated in advance well region governed rowkey range
Data can not be inserted :( disposable insert multiple columns)
put 'user','rk01','info:name','xuyu'
put 'user','rk01','info:age','18'
put 'user','rk01','info:sex','boy'
put 'user','rk01','data:pic','picture'
update data
put 'user', 'rk01' , 'info: name', 'xuyu1111' when the query name becomes xuyu1111 the
---------------------------------------------------------------------------------------------------------------------------------
Delete (delete the entire table when you want to disable the table, just open the file in the same time can not be renamed)
1disable 'test' disabled test table
2drop 'test' delete test table
3list found that test table has been deleted
4 enable 'user' is enabled table
Delete Column cluster:
alter 'user1', NAME => 'info', METHOD => 'delete'
alter 'user1', 'delete' => 'info'
delete data
delete 'user','rk01','info:name' 删除name
delete 'user', 'rk01' , 'info: name', 1534126109598 delete timestamp xxx 's name
Delete to delete the specified version :( up version)
delete 'user','rk01','info:name',TIMESTAMP=>1534138686498
Table judgment:
exists 'user' determination table
disable 'user' disable table
enable 'user' turn table
desc 'user' display attribute information table
Statistics: ( statistical efficiency is poor, not recommended )
count 'user'
Empty Table:
truncate 'user'
---------------------------------------------------------------------------------------------------------------------------------
Change (rename the entire table when you want to disable the table, just rename the file can not be opened at the same time)
1disable 'user'
There are updates, if any, new
alter 'user', NAME => 'f1'
alter 'user1',{NAME=>'data',BLOOMFILTER => 'ROWCOL',VERSIONS => '2'}
---------------------------------------------------------------------------------------------------------------------------------
check
describe 'user' is displayed name = Data , name = info series attribute information
Table scan ( Scan )
scan 'user' table scan, displays the contents of the data table
scan 'user', {COLUMNS = > [ 'info: name', 'info: age']} scans a given portion
Set query conditions: ( header without trailer )
scan 'user',{COLUMNS => ['info:name','info:age'],STARTROW=>'rk00002',LIMIT=>2}
scan 'user',{COLUMNS => ['info:name','info:age'],STARTROW=>'rk01',ENDROW=>'rk04',LIMIT=>2}
Note: This startrow and endrow only are RowKey (equivalent to the primary key)
Query data :( GET )
get 'user', 'rk01' acquired all the data
get 'user','rk01',{TIMESTAMP=>1534126755704}
get 'user', 'rk01' , 'info' Get column clusters info data
get 'user', 'rk01' , 'data' acquisition column clusters data Data
get 'user', 'rk01' , 'info: name' only get info the name
Get user table row key is rk0001 , info , Data information sequence family
get 'user', 'rk01' , 'info', 'data' acquisition info and data data
get 'user','rk01',{COLUMN=>['info','data']}
get 'user', 'rk01', {COLUMN => ['info:name', 'data:pic']}
Obtain user table row key to rk0001 , column family for the info , the version number of the latest 5 th information
get 'user', 'rk01', {COLUMN => 'info', VERSIONS => 2}
get 'user', 'rk01', {COLUMN => 'info:name', VERSIONS => 5}
GET 'User', 'rk01', {the COLUMN => 'info: name', the VERSIONS =>. 5, TIMERANGE => [1534123523054, xxxxxxxxxxxxxxx]} acquired . 5 version number in these 2 timestamp of the name
---------------------------------------------------------------------------------------------------------------------------------
N amespace operation in
list_namespace include all namespace (equivalent library), by default has 2 groups: default and hbase
create_namespace 'ns1' create a name for ns1 the namespace (equivalent to the library)
create 'ns1: user', ' info', 'data' in NSl ( namesqpce lower) built a user , the user before the addition ns1:
list_namespace_tables 'ns1' view ns1 under the table
alter_namespace 'ns1', {METHOD => 'set', 'NAME' => 'gjz1'} 修改
alter_namespace 'ns1', {METHOD => 'unset', NAME => 'NAME'} 删除
drop_namespace 'ns1' ### can only delete an empty namespace
describe_namespace 'ns1' View Description