whoami:
Show the current hbase user.
Example:
hbase> whoami
alter:
Alter column family schema; pass table name and a dictionary specifying new column family schema. Dictionaries are described below in the GENERAL NOTES section. Dictionary must include name
of column family to alter.
For example,
To change or add the 'f1' column family in table 't1' from defaults to instead keep a maximum of 5 cell VERSIONS, do:
hbase> alter 't1', {NAME => 'f1', VERSIONS => 5}
To delete the 'f1' column family in table 't1', do:
hbase> alter 't1', {NAME => 'f1', METHOD => 'delete'}
You can also change table-scope attributes like MAX_FILESIZE
MEMSTORE_FLUSHSIZE and READONLY.
For example, to change the max size of a family to 128MB, do:
hbase> alter 't1', {METHOD => 'table_att', MAX_FILESIZE => '134217728'}
count:
Count the number of rows in a table. This operation may take a LONG time (Run '$HADOOP_HOME/bin/hadoop jar hbase.jar rowcount' to run a counting mapreduce job). Current count is shown every 1000 rows by default. Count interval may be optionally specified.
Examples:
hbase> count 't1'
hbase> count 't1', 100000
hbase> t.count INTERVAL => 100000
hbase> t.count CACHE => 1000
hbase> t.count INTERVAL => 10, CACHE => 1000
Show the current hbase user.
Example:
hbase> whoami
Alter column family schema; pass table name and a dictionary specifying new column family schema. Dictionaries are described below in the GENERAL NOTES section. Dictionary must include name
of column family to alter.
For example,
To change or add the 'f1' column family in table 't1' from defaults to instead keep a maximum of 5 cell VERSIONS, do:
hbase> alter 't1', {NAME => 'f1', VERSIONS => 5}
To delete the 'f1' column family in table 't1', do:
hbase> alter 't1', {NAME => 'f1', METHOD => 'delete'}
You can also change table-scope attributes like MAX_FILESIZE
MEMSTORE_FLUSHSIZE and READONLY.
For example, to change the max size of a family to 128MB, do:
hbase> alter 't1', {METHOD => 'table_att', MAX_FILESIZE => '134217728'}
count:
Count the number of rows in a table. This operation may take a LONG time (Run '$HADOOP_HOME/bin/hadoop jar hbase.jar rowcount' to run a counting mapreduce job). Current count is shown every 1000 rows by default. Count interval may be optionally specified.
Examples:
hbase> count 't1'
hbase> count 't1', 100000
hbase> t.count INTERVAL => 100000
hbase> t.count CACHE => 1000
hbase> t.count INTERVAL => 10, CACHE => 1000
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}
describe:
Describe the named table
Example:
e.g. "hbase> describe 't1'"
Example:
e.g. "hbase> describe 't1'"
delete:
Put a delete cell value at specified table/row/column and optionally timestamp coordinates. Deletes must match the deleted cell's coordinates exactly. When scanning, a delete cell suppresses older versions. Takes arguments like the 'put' command described below
Example:
hbase> delete ‘t1′, ‘r1′, ‘c1′, ts1
Example:
hbase> delete ‘t1′, ‘r1′, ‘c1′, ts1
deleteall:
Delete all cells in a given row; pass a table name, row, and optionally a column and timestamp
Delete all cells in a given row; pass a table name, row, and optionally a column and timestamp.
Examples:
hbase> deleteall ‘t1′, ‘r1′
hbase> deleteall ‘t1′, ‘r1′, ‘c1′
hbase> deleteall ‘t1′, ‘r1′, ‘c1′, ts1
The same commands also can be run on a table reference. Suppose you had a reference t to table ‘t1′, the corresponding command would be:
Example:
hbase> t.deleteall ‘r1′
hbase> t.deleteall ‘r1′, ‘c1′
hbase> t.deleteall ‘r1′, ‘c1′, ts1
Delete all cells in a given row; pass a table name, row, and optionally a column and timestamp.
Examples:
hbase> deleteall ‘t1′, ‘r1′
hbase> deleteall ‘t1′, ‘r1′, ‘c1′
hbase> deleteall ‘t1′, ‘r1′, ‘c1′, ts1
The same commands also can be run on a table reference. Suppose you had a reference t to table ‘t1′, the corresponding command would be:
Example:
hbase> t.deleteall ‘r1′
hbase> t.deleteall ‘r1′, ‘c1′
hbase> t.deleteall ‘r1′, ‘c1′, ts1
disable:
Disable the named table:
Example:
e.g. "hbase> disable 't1'"
disable_all:
Disable all of tables matching the given regex
Example:
hbase> disable_all ‘t.*’
Example:
e.g. "hbase> disable 't1'"
disable_all:
Disable all of tables matching the given regex
Example:
hbase> disable_all ‘t.*’
drop:
Drop the named table. Table must first be disabled.
Example:
hbase> drop ‘t1′
drop_all:
Drop all of the tables matching the given regex
Example:
hbase> drop_all ‘t.*’
Example:
hbase> drop ‘t1′
drop_all:
Drop all of the tables matching the given regex
Example:
hbase> drop_all ‘t.*’
enable:
Enable the named table
Example:
hbase> enable ‘t1′
enable_all:
Enable all of the tables matching the given regex
Example:
hbase> enable_all ‘t.*’
is_enabled:
verifies Is named table enabled
Example:
hbase> is_enabled ‘t1′
Example:
hbase> enable ‘t1′
enable_all:
Enable all of the tables matching the given regex
Example:
hbase> enable_all ‘t.*’
is_enabled:
verifies Is named table enabled
Example:
hbase> is_enabled ‘t1′
exists:
Does the named table exist?
Example:
e.g. "hbase> exists 't1'"
Example:
e.g. "hbase> exists 't1'"
exit:
Type "hbase> exit" to leave the HBase Shell
get:
Get row or cell contents; pass table name, row, and optionally a dictionary of column(s), timestamp and versions.
Examples:
hbase> get 't1', 'r1'
hbase> get 't1', 'r1', {COLUMN => 'c1'}
hbase> get 't1', 'r1', {COLUMN => ['c1', 'c2', 'c3']}
hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1}
hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1, \
VERSIONS => 4}
list:
List all tables in hbase
Example:
hbase> list
hbase> list ‘abc.*’
Example:
hbase> list
hbase> list ‘abc.*’
put:
Put a cell 'value' at specified table/row/column and optionally timestamp coordinates. To put a cell value into table 't1' at row 'r1' under column 'c1' marked with the time 'ts1', do:
Example:
hbase> put 't1', 'r1', 'c1', 'value', ts1
tools:
Listing of hbase surgery tools
scan:
Scan a table; pass table name and optionally a dictionary of scanner specifications. Scanner specifications may include one or more of the following: LIMIT, STARTROW, STOPROW, TIMESTAMP, or COLUMNS. If no columns are specified, all columns will be scanned. To scan all members of a column family, leave the qualifier empty as in 'col_family:'.
Examples:
hbase> scan '.META.'
hbase> scan '.META.', {COLUMNS => 'info:regioninfo'}
hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, \
STARTROW => 'xyz'}
For experts, there is an additional option -- CACHE_BLOCKS -- which switches block caching for the scanner on (true) or off (false). By default it is enabled.
Examples:
hbase> scan 't1', {COLUMNS => ['c1', 'c2'], CACHE_BLOCKS => false}
status:
Show cluster status. Can be 'summary', 'simple', or 'detailed'. The default is 'summary'.
Examples:
hbase> status
hbase> status 'simple'
hbase> status 'summary'
hbase> status 'detailed'
shutdown:
Shut down the cluster.
truncate:
Disables, drops and recreates the specified table.
Example:
hbase>truncate ‘t1′
Example:
hbase>truncate ‘t1′
version:
Output this HBase version
Example:
hbase> version
show_filters:
Show all the filters in hbase.
Example:
hbase> show_filters
Example:
hbase> version
show_filters:
Show all the filters in hbase.
Example:
hbase> show_filters
alter_status:
Get the status of the alter command. Indicates the number of regions of the table that have received the updated schema Pass table name.
Example:
hbase> alter_status ‘t1′
flush:
Flush all regions in passed table or pass a region row to flush an individual region.
Example:
hbase> flush ‘TABLENAME’
hbase> flush ‘REGIONNAME’
major_compact:
Run major compaction on passed table or pass a region row to major compact an individual region. To compact a single column family within a region specify the region name followed by the column family name.
Examples:
Compact all regions in a table:
hbase> major_compact ‘t1′
Compact an entire region:
hbase> major_compact ‘r1′
Compact a single column family within a region:
hbase> major_compact ‘r1′, ‘c1′
Compact a single column family within a table:
hbase> major_compact ‘t1′, ‘c1′
split:
Split entire table or pass a region to split individual region. With the second parameter, you can specify an explicit split key for the region.
Examples:
hbase>split ‘tableName’
hbase>split ‘regionName’ # format: ‘tableName,startKey,id’
hbase>split ‘tableName’, ‘splitKey’
hbase>split ‘regionName’, ‘splitKey’
zk_dump:
Dump status of HBase cluster as seen by ZooKeeper.
Example:
hbase>zk_dump
start_replication:
Restarts all the replication features. The state in which each stream starts in is undetermined.
WARNING: start/stop replication is only meant to be used in critical load situations.
Examples:
hbase> start_replication
stop_replication:
Stops all the replication features. The state in which each stream stops in is undetermined.
WARNING: start/stop replication is only meant to be used in critical load situations.
Examples:
hbase> stop_replication
grant:
Grant users specific rights.
Syntax : grant permissions is either zero or more letters from the set “RWXCA”.
READ(‘R’), WRITE(‘W’), EXEC(‘X’), CREATE(‘C’), ADMIN(‘A’)
Example:
hbase> grant ‘bobsmith’, ‘RWXCA’
hbase> grant ‘bobsmith’, ‘RW’, ‘t1′, ‘f1′, ‘col1′
revoke:
Revoke a user’s access rights.
Syntax : revoke
Example:
hbase> revoke ‘bobsmith’, ‘t1′, ‘f1′, ‘col1′
user_permission:
Show all permissions for the particular user.
Syntax : user_permission
Example:
hbase> user_permission
hbase> user_permission ‘table1′
No comments:
Post a Comment