Getting Started
Introduction will get you up and running on a single-node, standalone instance of HBase.
Quick Start This guide describes setup of a standalone HBase instance. It will run against the local filesystem. In later sections we will take you through how to run HBase on Apache Hadoop's HDFS, a distributed filesystem. This section shows you how to create a table in HBase, inserting rows into your new HBase table via the HBase shell, and then cleaning up and shutting down your standalone, local filesystem-based HBase instance. The below exercise should take no more than ten minutes (not including download time). Local Filesystem and Durability Using HBase with a LocalFileSystem does not currently guarantee durability. The HDFS local filesystem implementation will lose edits if files are not properly closed -- which is very likely to happen when experimenting with a new download. You need to run HBase on HDFS to ensure all writes are preserved. Running against the local filesystem though will get you off the ground quickly and get you familiar with how the general system works so lets run with it for now. See and its associated issues for more details. Loopback IP The below advice is for hbase-0.94.x and older versions only. We believe this fixed in hbase-0.96.0 and beyond (let us know if we have it wrong). There should be no need of the below modification to /etc/hosts in later versions of HBase. HBase expects the loopback IP address to be 127.0.0.1. Ubuntu and some other distributions, for example, will default to 127.0.1.1 and this will cause problems for you See Why does HBase care about /etc/hosts? for detail. . /etc/hosts should look something like this: 127.0.0.1 localhost 127.0.0.1 ubuntu.ubuntu-domain ubuntu
JDK Version Requirements HBase requires that a JDK be installed. See for information about supported JDK versions.
Download and unpack the latest stable release. Choose a download site from this list of Apache Download Mirrors. Click on the suggested top link. This will take you to a mirror of HBase Releases. Click on the folder named stable and then download the file that ends in .tar.gz to your local filesystem; e.g. hbase-0.94.2.tar.gz. Decompress and untar your download and then change into the unpacked directory. .tar.gz $ cd hbase-]]> At this point, you are ready to start HBase. But before starting it, edit conf/hbase-site.xml, the file you write your site-specific configurations into. Set hbase.rootdir, the directory HBase writes data to, and hbase.zookeeper.property.dataDir, the directory ZooKeeper writes its data too: hbase.rootdir file:///DIRECTORY/hbase hbase.zookeeper.property.dataDir /DIRECTORY/zookeeper ]]> Replace DIRECTORY in the above with the path to the directory you would have HBase and ZooKeeper write their data. By default, hbase.rootdir is set to /tmp/hbase-${user.name} and similarly so for the default ZooKeeper data location which means you'll lose all your data whenever your server reboots unless you change it (Most operating systems clear /tmp on restart).
Start HBase Now start HBase: $ ./bin/start-hbase.sh starting Master, logging to logs/hbase-user-master-example.org.out You should now have a running standalone HBase instance. In standalone mode, HBase runs all daemons in the the one JVM; i.e. both the HBase and ZooKeeper daemons. HBase logs can be found in the logs subdirectory. Check them out especially if it seems HBase had trouble starting. Is <application>java</application> installed? All of the above presumes a 1.6 version of Oracle java is installed on your machine and available on your path (See ); i.e. when you type java, you see output that describes the options the java program takes (HBase requires java 6). If this is not the case, HBase will not start. Install java, edit conf/hbase-env.sh, uncommenting the JAVA_HOME line pointing it to your java install, then, retry the steps above.
Shell Exercises Connect to your running HBase via the shell. ' for list of supported commands. Type "exit" to leave the HBase Shell Version: 0.90.0, r1001068, Fri Sep 24 13:55:42 PDT 2010 hbase(main):001:0>]]> Type help and then <RETURN> to see a listing of shell commands and options. Browse at least the paragraphs at the end of the help emission for the gist of how variables and command arguments are entered into the HBase shell; in particular note how table names, rows, and columns, etc., must be quoted. Create a table named test with a single column family named cf. Verify its creation by listing all tables and then insert some values. create 'test', 'cf' 0 row(s) in 1.2200 seconds hbase(main):003:0> list 'test' .. 1 row(s) in 0.0550 seconds hbase(main):004:0> put 'test', 'row1', 'cf:a', 'value1' 0 row(s) in 0.0560 seconds hbase(main):005:0> put 'test', 'row2', 'cf:b', 'value2' 0 row(s) in 0.0370 seconds hbase(main):006:0> put 'test', 'row3', 'cf:c', 'value3' 0 row(s) in 0.0450 seconds]]> Above we inserted 3 values, one at a time. The first insert is at row1, column cf:a with a value of value1. Columns in HBase are comprised of a column family prefix -- cf in this example -- followed by a colon and then a column qualifier suffix (a in this case). Verify the data insert by running a scan of the table as follows scan 'test' ROW COLUMN+CELL row1 column=cf:a, timestamp=1288380727188, value=value1 row2 column=cf:b, timestamp=1288380738440, value=value2 row3 column=cf:c, timestamp=1288380747365, value=value3 3 row(s) in 0.0590 seconds]]> Get a single row get 'test', 'row1' COLUMN CELL cf:a timestamp=1288380727188, value=value1 1 row(s) in 0.0400 seconds]]> Now, disable and drop your table. This will clean up all done above. h disable 'test' 0 row(s) in 1.0930 seconds hbase(main):013:0> drop 'test' 0 row(s) in 0.0770 seconds ]]> Exit the shell by typing exit. exit]]>
Stopping HBase Stop your hbase instance by running the stop script. $ ./bin/stop-hbase.sh stopping hbase...............
Where to go next The above described standalone setup is good for testing and experiments only. In the next chapter, , we'll go into depth on the different HBase run modes, system requirements running HBase, and critical configurations setting up a distributed HBase deploy.