2013年6月12日星期三

[Linux] Hbase shell

# Use for commands:
help 'command', status, list, describe 'tablename'
*The status shows the basic status of the cluster.
status 'simple'
status 'detailed'

# Create tables:
create 'tablename', {NAME=>'family 1'}, {NAME=>'family 2'}
create 'tablename', 'family1', 'family2'

# Scan table:
scan 'tablename'
*Restrict columns: {COLUMNS=>'family:'}, {COLUMNS=>['c1', 'c2']
*Restrict number of results: {LIMIT=>number}
*Restrict start / stop row: {STARTROW=>'start row key', ENDROW=>'end row key'}

# Count:
count 'tablename', 5000
*Here 5000 is means report results every 5000 rows.

# Delete:
delete 'table', 'rowkey', 'colkey(family:column)'
delete 'table', 'rowkey'
*Delete all rows in the table.
truncate 'tablename'

# Remove table:
*First you need to disable the table, and then you can drop table.
disable 'tablename'
drop 'tablename'

# Change column family:
*Must disable table first, and then change column family
alter 'tablename', {NAME=>'family', METHOD=>'delete'}

- Hbase files stored as HFiles in HDFS.
- sorted key/value pairs and an index of keys.
- /hbase/tablename/region/column-family

没有评论:

发表评论