hbase安装配置---coco
#by coco
#2014-07-25
4. hbase配置
下载:hbase-0.96.2-hadoop2-bin.tar.gz
[root@db96 ~]# wget http://apache.dataguru.cn/hbase/hbase-0.96.2/hbase-0.96.2-hadoop2-bin.tar.gz
[root@db96 ~]# tar -zxvf hbase-0.96.2-hadoop2-bin.tar.gz -C /usr/local/
[root@db96 ~]# cd /usr/local/
[root@db96 local]# ln -s /usr/local/hbase-0.96.2-hadoop2/ hbase
配置分布式hbase
1. vi hbase-env.sh, 添加java_home路径,和 托管zookeeper: HBASE_MANAGES_ZK
[root@db96 conf]# vim hbase-env.sh
# The java implementation to use. Java 1.6 required.
export JAVA_HOME=/usr/java/default/
# Tell HBase whether it should manage it's own instance of Zookeeper or not.
export HBASE_MANAGES_ZK=false
注意:
一个分布式运行的Hbase依赖一个zookeeper集群。所有的节点和客户端都必须能够访问zookeeper。
默认的情况下Hbase会管理一个zookeep集群。这个集群会随着Hbase的启动而启动。当然,
你也可以自己管理一个zookeeper集群,但需要配置Hbase。你需要修改conf/hbase-env.sh
里面的HBASE_MANAGES_ZK 来切换。这个值默认是true的,作用是让Hbase启动的时候同时也启动zookeeper.
让Hbase使用一个现有的不被Hbase托管的Zookeep集群,需要设置
conf/hbase-env.sh文件中的HBASE_MANAGES_ZK 属性为 false
2. vi hbase-site.xml, 添加如下信息。
[root@db96 conf]# vim hbase-site.xml
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://db96:9000/data/hadoop/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2181</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>db96,db98,db99</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/usr/local/zookeeper/data</value>
</property>
<property>
<name>zookeeper.session.timeout</name>
<value>90000</value>
</property>
</configuration>
3. 修改regiionservers
[root@db96 conf]# vi regionservers
db98
db99
把配置好的hbase安装文件,scp 到其他从库上。
[root@db96 local]# scp -r hbase-0.96.2-hadoop2 db98:/usr/local/
[root@db96 local]# scp -r hbase-0.96.2-hadoop2 db99:/usr/local/
[root@db98 local]# ln -s /usr/local/hbase-0.96.2-hadoop2/ hbase
[root@db99 local]# ln -s /usr/local/hbase-0.96.2-hadoop2/ hbase
启动测试:
[root@db96 logs]# /usr/local/hbase/bin/start-hbase.sh
[root@db96 data]# hbase shell
2014-07-22 13:44:29,069 INFO [main] Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.available
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.96.2-hadoop2, r1581096, Mon Mar 24 16:03:18 PDT 2014
hbase(main):001:0> list
TABLE
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/hbase-0.96.2-hadoop2/lib/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/hadoop2/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
0 row(s) in 1.6240 seconds
=> []
hbase(main):002:0> create 'test','fa'
0 row(s) in 0.4500 seconds
=> Hbase::Table - test
hbase(main):003:0> list
TABLE
test
1 row(s) in 0.0520 seconds
=> ["test"]
hbase(main):004:0> put 'test' ,'row1','fa:id','1'
0 row(s) in 0.1400 seconds
hbase(main):005:0> put 'test' ,'row1','fa:name','hello'
0 row(s) in 0.0320 seconds
hbase(main):006:0> scan 'test'
ROW COLUMN+CELL
row1 column=fa:id, timestamp=1406008079789, value=1
row1 column=fa:name, timestamp=1406008102146, value=hello
1 row(s) in 0.0310 seconds
hbase(main):007:0> create 'student','info'
0 row(s) in 0.4360 seconds
=> Hbase::Table - student
hbase(main):008:0> list
TABLE
student
test
2 row(s) in 0.0400 seconds
=> ["student", "test"]
hbase(main):009:0> exit
#by coco
#2014-07-25
4. hbase配置
下载:hbase-0.96.2-hadoop2-bin.tar.gz
[root@db96 ~]# wget http://apache.dataguru.cn/hbase/hbase-0.96.2/hbase-0.96.2-hadoop2-bin.tar.gz
[root@db96 ~]# tar -zxvf hbase-0.96.2-hadoop2-bin.tar.gz -C /usr/local/
[root@db96 ~]# cd /usr/local/
[root@db96 local]# ln -s /usr/local/hbase-0.96.2-hadoop2/ hbase
配置分布式hbase
1. vi hbase-env.sh, 添加java_home路径,和 托管zookeeper: HBASE_MANAGES_ZK
[root@db96 conf]# vim hbase-env.sh
# The java implementation to use. Java 1.6 required.
export JAVA_HOME=/usr/java/default/
# Tell HBase whether it should manage it's own instance of Zookeeper or not.
export HBASE_MANAGES_ZK=false
注意:
一个分布式运行的Hbase依赖一个zookeeper集群。所有的节点和客户端都必须能够访问zookeeper。
默认的情况下Hbase会管理一个zookeep集群。这个集群会随着Hbase的启动而启动。当然,
你也可以自己管理一个zookeeper集群,但需要配置Hbase。你需要修改conf/hbase-env.sh
里面的HBASE_MANAGES_ZK 来切换。这个值默认是true的,作用是让Hbase启动的时候同时也启动zookeeper.
让Hbase使用一个现有的不被Hbase托管的Zookeep集群,需要设置
conf/hbase-env.sh文件中的HBASE_MANAGES_ZK 属性为 false
2. vi hbase-site.xml, 添加如下信息。
[root@db96 conf]# vim hbase-site.xml
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://db96:9000/data/hadoop/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2181</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>db96,db98,db99</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/usr/local/zookeeper/data</value>
</property>
<property>
<name>zookeeper.session.timeout</name>
<value>90000</value>
</property>
</configuration>
3. 修改regiionservers
[root@db96 conf]# vi regionservers
db98
db99
把配置好的hbase安装文件,scp 到其他从库上。
[root@db96 local]# scp -r hbase-0.96.2-hadoop2 db98:/usr/local/
[root@db96 local]# scp -r hbase-0.96.2-hadoop2 db99:/usr/local/
[root@db98 local]# ln -s /usr/local/hbase-0.96.2-hadoop2/ hbase
[root@db99 local]# ln -s /usr/local/hbase-0.96.2-hadoop2/ hbase
启动测试:
[root@db96 logs]# /usr/local/hbase/bin/start-hbase.sh
[root@db96 data]# hbase shell
2014-07-22 13:44:29,069 INFO [main] Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.available
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.96.2-hadoop2, r1581096, Mon Mar 24 16:03:18 PDT 2014
hbase(main):001:0> list
TABLE
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/hbase-0.96.2-hadoop2/lib/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/hadoop2/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
0 row(s) in 1.6240 seconds
=> []
hbase(main):002:0> create 'test','fa'
0 row(s) in 0.4500 seconds
=> Hbase::Table - test
hbase(main):003:0> list
TABLE
test
1 row(s) in 0.0520 seconds
=> ["test"]
hbase(main):004:0> put 'test' ,'row1','fa:id','1'
0 row(s) in 0.1400 seconds
hbase(main):005:0> put 'test' ,'row1','fa:name','hello'
0 row(s) in 0.0320 seconds
hbase(main):006:0> scan 'test'
ROW COLUMN+CELL
row1 column=fa:id, timestamp=1406008079789, value=1
row1 column=fa:name, timestamp=1406008102146, value=hello
1 row(s) in 0.0310 seconds
hbase(main):007:0> create 'student','info'
0 row(s) in 0.4360 seconds
=> Hbase::Table - student
hbase(main):008:0> list
TABLE
student
test
2 row(s) in 0.0400 seconds
=> ["student", "test"]
hbase(main):009:0> exit