1) 解压缩下载的hbase文件(注意:对应hadoop的安装版本)
[grid@h1 ~]$ tar -zxvf hbase-0.95.2-hadoop1-bin.tar.gz [grid@h1 ~]$ ll hbase-0.95.2-hadoop2
总计 460
drwxr-xr-x 4 grid grid 4096 08-10 12:10 bin
-rw-r--r-- 1 grid grid 415807 08-16 04:00 CHANGES.txt
drwxr-xr-x 2 grid grid 4096 07-27 06:44 conf
drwxr-xr-x 25 grid grid 4096 08-16 04:28 docs
drwxr-xr-x 7 grid grid 4096 08-16 04:23 hbase-webapps
drwxrwxr-x 3 grid grid 12288 08-29 22:42 lib
-rw-r--r-- 1 grid grid 11358 07-27 06:44 LICENSE.txt
-rw-r--r-- 1 grid grid 897 07-27 06:44 NOTICE.txt
-rw-r--r-- 1 grid grid 1377 07-27 06:44 README.txt
[grid@h1 ~]$ mv hbase-0.95.2-hadoop1 hbase
2) 查看hadoop环境
[grid@h1 ~]$ cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.76.2 h1
192.168.76.3 h2
192.168.76.4 h3
[grid@h1 ~]$ hadoop version
Hadoop 1.2.1
Subversion https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1.2 -r 1503152
Compiled by mattf on Mon Jul 22 15:23:09 PDT 2013
From source with checksum 6923c86528809c4e7e6f493b6b413a9a
This command was run using null
3)[grid@h1 conf]$ vi hbase-env.sh
export JAVA_HOME=/usr/jdk1.6.0_45
设置java环境变量
export HBASE_MANAGES_ZK=true
启动hbase同时启动zookeeper
4) vi hbase-site.xml
-->
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://h1:9000/hbase</value>
<description>The directory shared byRegionServers.</description>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
<description>The mode the clusterwill be in. Possible values are
false: standalone and pseudo-distributedsetups with managed Zookeeper
true: fully-distributed with unmanagedZookeeper Quorum (see hbase-env.sh )
</description>
</property>
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2222</value>
<description>Property fromZooKeeper's config zoo.cfg.
The port at which the clients willconnect.
</description>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>h1,h2,h3</value>
<description>Comma separated listof servers in the ZooKeeper Quorum.
For example,"host1.mydomain.com,host2.mydomain.com, host3.mydomain.com ".
By default this is set to localhost forlocal and pseudo-distributed modes
of operation. For a fully-distributedsetup, this should be set to a full
list of ZooKeeper quorum servers. IfHBASE_MANAGES_ZK is set in hbase-env.sh
this is the list of servers which we willstart/stop ZooKeeper on.
</description>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/home/grid/hadoop-1.2.1/zk_tmp</value>
<description>Property fromZooKeeper's config zoo.cfg.
The directory where the snapshot isstored.
</description>
</property>
</configuration>
5) vi regionservers
h2
h3
6) 拷贝hadoop的jar包到hbase
[grid@h1 lib]$ cp ../../hadoop-1.2.1/hadoop-core-1.2.1.jar .
[grid@h1 lib]$ pes
-bash: pes: command not found
[grid@h1 lib]$ pwd
/home/grid/hbase/lib
[grid@h1 lib]$
7)将hbase拷贝到其他节点服务器
8)启动hbase
[grid@h1 hbase]$ bin/start-hbase.sh
h2: starting zookeeper, logging to /home/grid/hbase/bin/../logs/hbase-grid-zookeeper-h2.out
h3: starting zookeeper, logging to /home/grid/hbase/bin/../logs/hbase-grid-zookeeper-h3.out
h1: starting zookeeper, logging to /home/grid/hbase/bin/../logs/hbase-grid-zookeeper-h1.out
starting master, logging to /home/grid/hbase/bin/../logs/hbase-grid-master-h1.out
h2: starting regionserver, logging to /home/grid/hbase/bin/../logs/hbase-grid-regionserver-h2.out
h3: starting regionserver, logging to /home/grid/hbase/bin/../logs/hbase-grid-regionserver-h3.out
9) 检查hbase启动
[grid@h1 hbase]$ jps
22718 HQuorumPeer
23007 Jps
22273 SecondaryNameNode
22115 NameNode
22355 JobTracker
22773 HMaster
[grid@h1 hbase]$ bin/hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.96.0-hadoop1, r1531434, Fri Oct 11 15:11:29 PDT 2013
创建测试表
hbase(main):003:0> create 'member','member_id','address','info'
0 row(s) in 0.7620 seconds
=> Hbase::Table - member
hbase(main):001:0> list
TABLE
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/grid/hbase/lib/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/grid/hadoop-1.2.1/lib/slf4j-log4j12-1.4.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
member
1 row(s) in 0.9440 seconds
=> ["member"]
[grid@h1 ~]$ tar -zxvf hbase-0.95.2-hadoop1-bin.tar.gz [grid@h1 ~]$ ll hbase-0.95.2-hadoop2
总计 460
drwxr-xr-x 4 grid grid 4096 08-10 12:10 bin
-rw-r--r-- 1 grid grid 415807 08-16 04:00 CHANGES.txt
drwxr-xr-x 2 grid grid 4096 07-27 06:44 conf
drwxr-xr-x 25 grid grid 4096 08-16 04:28 docs
drwxr-xr-x 7 grid grid 4096 08-16 04:23 hbase-webapps
drwxrwxr-x 3 grid grid 12288 08-29 22:42 lib
-rw-r--r-- 1 grid grid 11358 07-27 06:44 LICENSE.txt
-rw-r--r-- 1 grid grid 897 07-27 06:44 NOTICE.txt
-rw-r--r-- 1 grid grid 1377 07-27 06:44 README.txt
[grid@h1 ~]$ mv hbase-0.95.2-hadoop1 hbase
2) 查看hadoop环境
[grid@h1 ~]$ cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.76.2 h1
192.168.76.3 h2
192.168.76.4 h3
[grid@h1 ~]$ hadoop version
Hadoop 1.2.1
Subversion https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1.2 -r 1503152
Compiled by mattf on Mon Jul 22 15:23:09 PDT 2013
From source with checksum 6923c86528809c4e7e6f493b6b413a9a
This command was run using null
3)[grid@h1 conf]$ vi hbase-env.sh
export JAVA_HOME=/usr/jdk1.6.0_45
设置java环境变量
export HBASE_MANAGES_ZK=true
启动hbase同时启动zookeeper
4) vi hbase-site.xml
-->
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://h1:9000/hbase</value>
<description>The directory shared byRegionServers.</description>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
<description>The mode the clusterwill be in. Possible values are
false: standalone and pseudo-distributedsetups with managed Zookeeper
true: fully-distributed with unmanagedZookeeper Quorum (see hbase-env.sh )
</description>
</property>
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2222</value>
<description>Property fromZooKeeper's config zoo.cfg.
The port at which the clients willconnect.
</description>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>h1,h2,h3</value>
<description>Comma separated listof servers in the ZooKeeper Quorum.
For example,"host1.mydomain.com,host2.mydomain.com, host3.mydomain.com ".
By default this is set to localhost forlocal and pseudo-distributed modes
of operation. For a fully-distributedsetup, this should be set to a full
list of ZooKeeper quorum servers. IfHBASE_MANAGES_ZK is set in hbase-env.sh
this is the list of servers which we willstart/stop ZooKeeper on.
</description>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/home/grid/hadoop-1.2.1/zk_tmp</value>
<description>Property fromZooKeeper's config zoo.cfg.
The directory where the snapshot isstored.
</description>
</property>
</configuration>
5) vi regionservers
h2
h3
6) 拷贝hadoop的jar包到hbase
[grid@h1 lib]$ cp ../../hadoop-1.2.1/hadoop-core-1.2.1.jar .
[grid@h1 lib]$ pes
-bash: pes: command not found
[grid@h1 lib]$ pwd
/home/grid/hbase/lib
[grid@h1 lib]$
7)将hbase拷贝到其他节点服务器
8)启动hbase
[grid@h1 hbase]$ bin/start-hbase.sh
h2: starting zookeeper, logging to /home/grid/hbase/bin/../logs/hbase-grid-zookeeper-h2.out
h3: starting zookeeper, logging to /home/grid/hbase/bin/../logs/hbase-grid-zookeeper-h3.out
h1: starting zookeeper, logging to /home/grid/hbase/bin/../logs/hbase-grid-zookeeper-h1.out
starting master, logging to /home/grid/hbase/bin/../logs/hbase-grid-master-h1.out
h2: starting regionserver, logging to /home/grid/hbase/bin/../logs/hbase-grid-regionserver-h2.out
h3: starting regionserver, logging to /home/grid/hbase/bin/../logs/hbase-grid-regionserver-h3.out
9) 检查hbase启动
[grid@h1 hbase]$ jps
22718 HQuorumPeer
23007 Jps
22273 SecondaryNameNode
22115 NameNode
22355 JobTracker
22773 HMaster
[grid@h1 hbase]$ bin/hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.96.0-hadoop1, r1531434, Fri Oct 11 15:11:29 PDT 2013
创建测试表
hbase(main):003:0> create 'member','member_id','address','info'
0 row(s) in 0.7620 seconds
=> Hbase::Table - member
hbase(main):001:0> list
TABLE
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/grid/hbase/lib/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/grid/hadoop-1.2.1/lib/slf4j-log4j12-1.4.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
member
1 row(s) in 0.9440 seconds
=> ["member"]