Quick Start to hadoop hbase
Cheungmine
2012-4-20
This article solves the problem of standlone running hbase. You can quickly learn about the basic shell commands of hbase.
Step 1 prepare the software
Machine environment: ubuntu11.10 + jdk1.6
Software: hbase-0.92.1.tar.gz
My username is cl
My machine name is ThinkPad-Zh.
Decompress hbase:
$ Tar xzf/home/CL/downloads/hbase-0.92.1.tar.gz
Copy to the directory:
/Home/hbase-0.92.1
Step 2 configure hbase
Change Configuration:
1) configure the JDK path
.../Hbase-0.92.1/CONF/hbase-env.sh
Modify the following rows:
# Export java_home =/usr/Java/jdk1.6.0/
Export java_home =/usr/local/Java/jdk1.6.0 _ 30
2) configure the database file path
.../Hbase-0.92.1/CONF/hbasev-site.xml
To the following:
<Configuration>
<Property>
<Name> hbase. rootdir </Name>
<Value>File: // home/CL/hbase_data</Value>
</Property>
</Configuration>
Step 3 use the command line
1) Start hbase Database
CL @ ThinkPad-Zh:/home/hbase-0.92.1/bin $./start-hbase.sh
2) Stop hbase database command:
... $./Stop-hbase.sh
3) FAQs
Log in:
.../Hbase-0.92.1/logs/hbase-cl-master-thinkpad-zh.log
If the following occurs in the log:
... Warn org. Apache. hadoop. hbase. master. assignmentmanager: unable to find a viable location to assign region-root-, 0.70236052
The table cannot be created later (create 'tablename' will wait indefinitely)
In this case, you need to modify:
$ Sudo VI/etc/hosts
Is:
127.0.0.1 localhost
#127.0.1.1 ThinkPad-ZH
127.0.0.1 ThinkPad-ZH
Restart the database (if the process NNNN already exists, $ kill NNNN first ):
CL @ ThinkPad-Zh:/home/hbase-0.92.1/bin $./start-hbase.sh
Starting master, logging to/home/hbase-0.92.1/bin/../logs/hbase-cl-master-thinkpad-zh.out
4) run the hbase shell command tool
CL @ ThinkPad-Zh:/home/hbase-0.92.1/bin $./hbase Shell
Hbase shell; enter 'help <return> 'for list of supported commands.
Type "Exit <return>" to leave the hbase Shell
Version 0.92.1, r1298924, Fri Mar 9 16:58:34, UTC 2012
5) create a table
Hbase (main): 001: 0> Create 'my _ first_table ', 'col1', 'col2'
0 row (s) in 1.6050 seconds
Hbase (main): 002: 0>
Hbase (main): 002: 0> List 'my _ first_table'
Table
My_first_table
1 row (s) in 0.0150 seconds
6) Exit Shell
Hbase (main): 003: 0> exit
7) Stop hbase Database
CL @ ThinkPad-Zh:/home/hbase-0.92.1/bin $./stop-hbase.sh
Stopping hbase ............
CL @ ThinkPad-Zh:/home/hbase-0.92.1/bin $