hbase搭建

  • 前置条件

hadoop环境运行正常。
  • 步骤

下载hbase压缩包hbase-0.94.2.tar.gz,并解压tar -zxvf  *.gz
配置hbase-site.xml
<property>
<name>hbase.rootdir</name>
<value>hdfs://master:8020/hbase</value>
<description>The directory shared by region servers and into
which HBase persists. The URL should be 'fully-qualified'
to include the filesystem scheme. For example, to specify the
HDFS directory '/hbase' where the HDFS instance's namenode is
running at namenode.example.org on port 9000, set this value to:
hdfs://namenode.example.org:9000/hbase. By default HBase writes
into /tmp. Change this configuration else all data will be lost
on machine restart.
</description>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
<description>The mode the cluster will be in. Possible values are
false for standalone mode and true for distributed mode. If
false, startup will run all HBase and ZooKeeper daemons together
in the one JVM.
</description>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>10.200.187.77,10.200.187.78</value>
<description>Comma separated list of servers in the ZooKeeper Quorum.
For example, "host1.mydomain.com,host2.mydomain.com,host3.mydomain.com".
By default this is set to localhost for local and pseudo-distributed modes
of operation. For a fully-distributed setup, this should be set to a full
list of ZooKeeper quorum servers. If HBASE_MANAGES_ZK is set in hbase-env.sh
this is the list of servers which we will start/stop ZooKeeper on.
</description>
</property>

配置hbase-env.sh
export HBASE_OPTS="$HBASE_OPTS -Xgcprio:throughput"
export JAVA_HOME=/home/hadoop/jrockit-jdk1.6.0_29
export HBASE_MANAGES_ZK=true
export HBASE_HOME=/home/hadoop/hbase-0.94.2
export HADOOP_HOME=/home/hadoop/hadoop-1.0.3


由于我们使用jrocekit jdk版本,所有参数类似-Xgcprio:throughput,若我们使用正常jdk版本使用系统默认设置即可。

HBASE_MANAGES_ZK=true表示使用hbase内置zookeeper,即也会使用hbase-site.xml中zoopkeeper的设置,若不使用内置zookeeper,将其设成false,然后安装自己的zookeeper,并启动。
启动hbase
./start-hbase.sh
  • 遇到问题

hbase脚本中-XX:OnOutOfMemoryError="kill -9 %p"参数不识别,因为使用的jrocekit版本,然后使用jrocekit版本的-XXexitOnOutOfMemory同样不行。目前没有解决。
Unknown option or illegal argument: -XXexitOnOutOfMemory. 
Please check for incorrect spelling or review documentation of startup options.

Could not create the Java virtual machine.


Unix:
-XX:OnOutOfMemoryError="kill -9 %p"

Windows:
-XX:OnOutOfMemoryError="taskkill /F /PID %p"

JRockIT:
-XXexitOnOutOfMemory
  • 问题解决
  • Jerockit新版本参数有变动,参考:
    http://docs.oracle.com/cd/E15289_01/doc.40/e15062/optionxx.htm#BABCDAIB
    JRockIT:
    -XX:+ExitOnOutOfMemoryError


    你可能感兴趣的:(hbase 搭建)