Database Reference
In-Depth Information
Test Drive
To start a standalone instance of HBase that uses a temporary directory on the local
filesystem for persistence, use this:
%
start-hbase.sh
By default, HBase writes to
/${java.io.tmpdir}/hbase-${user.name}
.
${java.io.tmpdir}
usually maps to
/tmp
, but you should configure HBase to use a
more permanent location by setting
hbase.tmp.dir
in
hbase-site.xml
. In standalone
mode, the HBase master, the regionserver, and a
ZooKeeper
instance are all run in the
same JVM.
To administer your HBase instance, launch the HBase shell as follows:
%
hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.98.7-hadoop2, r800c23e2207aa3f9bddb7e9514d8340bcfb89277,
Wed Oct 8
15:58:11 PDT 2014
hbase(main):001:0>
This will bring up a JRuby IRB interpreter that has had some HBase-specific commands
added to it. Type
help
and then press Return to see the list of shell commands grouped
into categories. Type
help "
COMMAND_GROUP
"
for help by category or
help
"
COMMAND
"
for help on a specific command and example usage. Commands use Ruby
formatting to specify lists and dictionaries. See the end of the main help screen for a quick
tutorial.
Now let's create a simple table, add some data, and then clean up.
To create a table, you must name your table and define its schema. A table's schema com-
prises table attributes and the list of table column families. Column families themselves
have attributes that you in turn set at schema definition time. Examples of column family
attributes include whether the family content should be compressed on the filesystem and
how many versions of a cell to keep. Schemas can be edited later by offlining the table us-
ing the shell
disable
command, making the necessary alterations using
alter
, then
putting the table back online with
enable
.
To create a table named
test
with a single column family named
data
using defaults
for table and column family attributes, enter: