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 $
From cheungmine's column