* Because the environment is clicked, hadoop cannot be started. **********************
I. installation environment
1. VM: VMWare
2. OS: centos
3. JDK: jdk1.6
4. hbase: hbase-0.94.9.tar.gz.
Ii. Download and decompress the hbase release package
1. This article uses hbase stable version: hbase-0.94.9.tar.gz. Its:
Http://www.apache.org/dyn/closer.cgi/hbase/
2. Put hbase-0.94.9.tar.gz in the selected folder and decompress it. The shell command is as follows:
$ Tar-xfz hbase-0.94.9.tar.gz
3. Modify the hbase configuration file
1. hbase-env.sh
Cancel the JDK configuration annotation and make the following changes (My JDK installation path ):
Export java_home =/usr/Java/jdk1.6.0 _ 27/
2. hbase-site.xml
Because it is started on a single machine, only the local path written to hbase is set. The modification is as follows:
<? XML version = "1.0"?>
<? XML-stylesheet type = "text/XSL" href = "configuration. XSL"?>
<Configuration>
<Property>
<Name> hbase. rootdir </Name>
<Value>/home/hbase </value>
</Property>
</Configuration>
4. Start hbase
Root @ Ubuntu:/usr/hbase/hbase-0.94.9 # bin/start-hbase.sh
V. Shell practices
1. UseShellTo connect to hbase.
Root @ Ubuntu: # bin/hbase Shell
Hbase shell; enter 'help <return> 'for list of supported commands.
Type "Exit <return>" to leave the hbase Shell
Version 0.90.4, r1150278, Sun Jul 24 15:53:29 PDT 2011
3. Table creation demonstration
Hbase (main): 004: 0> Create 'table1', 'col1'
0 row (s) in 1.1070 seconds
Hbase (main): 005: 0> List
Table
Table1
Test1
2 row (s) in 0.0210 seconds
Hbase (main): 006: 0> put 'table1', 'row1', 'col1: A', 'value1'
0 row (s) in 0.2710 seconds
Hbase (main): 008: 0> put 'table1', 'row2', 'col1: B ', 'value2'
0 row (s) in 0.0090 seconds
Hbase (main): 009: 0> put 'table1', 'row3', 'col1: C', 'value3'
0 row (s) in 0.0070 seconds
Hbase (main): 010: 0>
4. Use scan to view all table data
Hbase (main): 010: 0> scan 'table1'
Row column + cell
Row1 column = col1: A, timestamp = 1317180621803, value = value1
Row2 column = col1: B, timestamp = 1317180679999, value = value2
Row3 column = col1: C, timestamp = 1317180708854, value = value3
3 row (s) in 0.0570 seconds
5. Use get to view a single row of data
Hbase (main): 011: 0> Get 'table1', 'row1'
Column cell
Col1: a timestamp = 1317180621803, value = value1
1 row (s) in 0.0160 seconds
6. delete a table with disable and drop
Hbase (main): 017: 0> disable 'table1'
0 row (s) in 2.0470 seconds
Hbase (main): 018: 0> drop 'table1'
0 row (s) in 0.0960 seconds
Hbase (main): 019: 0> List
Table
1 row (s) in 0.0170 seconds
6. Stop hbase
Root @ Ubuntu:/usr/hbase/hbase-0.90.4 # bin/stop-hbase.sh
Stopping hbase .......
7. View hbase information in a browser
Access address: http: // localhost: 60010/
The effect is as follows:
8. Start hbase rest Service
The startup command is as follows:
Root @ Ubuntu:/usr/hbase/hbase-0.90.4 # bin/hbase rest start
11/09/27 20:58:01 info JVM. jv1_rics: initializing JVM metrics with processname = rest, sessionid = Main
11/09/27 20:58:01 info hbase. Metrics: New mbeaninfo
11/09/27 20:58:01 info mortbay. Log: logging to org. slf4j. impl. log4jloggeradapter (Org. mortbay. Log) via org. mortbay. log. slf4jlog
11/09/27 20:58:01 info mortbay. Log: jetty-6.1.26
11/09/27 20:58:01 info mortbay. Log: started
SocketConnector@0.0.0.0: 8080
Test: http: // localhost: 8080/
Note: You can use rest operations (get/post/Put/delete) to perform rest data operations on hbase.
IX. Problems Encountered
1.
Hbase (main): 001: 0> Create 'test', 'cf'
Error: org. Apache. hadoop. hbase. notallmetaregionsonlineexception: org. Apache. hadoop. hbase. notallmetaregionsonlineexception: timed out (10000 ms)
Solution: Modify/etc/hosts. Change Ubuntu 127.0.1.1 to the local IP address. OK!
2.
[Lei @ Coco bin] $./start-hbase.sh
COCO: Starting zookeeper, logging to/usr/hadoop/hbase-0.94.9/bin/../logs/hbase-lei-zookeeper-coco.out
Starting master, logging to/usr/hadoop/hbase-0.94.9/bin/../logs/hbase-lei-master-coco.out
/Usr/hadoop/hbase-0.94.9/bin/hbase-daemon.sh: Line 158:/tmp/hbase-lei-master.pid: Permission denied
COCO: Starting regionserver, logging to/usr/hadoop/hbase-0.94.9/bin/../logs/hbase-lei-regionserver-coco.out
# Localhost: SSH: # localhost: Name or service not known
[Lei @ Coco bin] $ JPs
6425 hquorumpeer
6611 hregionserver
JPS 6713
Solution:
Hbase-site.xml Not Configured
10. Others
Hbase download:
Http://hbase.apache.org/
Hbase Development Guide in English:
Http://hbase.apache.org/book/book.html