Skip to content

Instantly share code, notes, and snippets.

@kovyrin
Created March 9, 2010 05:15
Show Gist options
  • Save kovyrin/326249 to your computer and use it in GitHub Desktop.
Save kovyrin/326249 to your computer and use it in GitHub Desktop.
hbase(main):003:0> help 'ddl'
TABLES MANAGEMENT COMMANDS
--------------------------------------------------------------------------------
COMMAND: alter
Alter column family schema; pass table name and a dictionary
specifying new column family schema. Dictionaries are described
on the main help command output. 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'
or a shorter version:
hbase> alter 't1', 'delete' => 'f1'
You can also change table-scope attributes like MAX_FILESIZE
MEMSTORE_FLUSHSIZE, READONLY, and DEFERRED_LOG_FLUSH.
For example, to change the max size of a family to 128MB, do:
hbase> alter 't1', METHOD => 'table_att', MAX_FILESIZE => '134217728'
There could be more than one alteration in one command:
hbase> alter 't1', {NAME => 'f1'}, {NAME => 'f2', METHOD => 'delete'}
COMMAND: 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}
COMMAND: describe
Describe the named table. For example:
hbase> describe 't1'
COMMAND: disable
Disable the named table: e.g. "hbase> disable 't1'"
COMMAND: drop
Drop the named table. Table must first be disabled. If table has
more than one region, run a major compaction on .META.:
hbase> major_compact ".META."
COMMAND: enable
Enable the named table: e.g. "hbase> enable 't1'"
COMMAND: exists
Does the named table exist? e.g. "hbase> exists 't1'"
COMMAND: list
List all tables in hbase
hbase(main):004:0>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment