现在的位置: 首页 > 综合 > 正文

如何安装Hbase

2013年10月01日 ⁄ 综合 ⁄ 共 3931字 ⁄ 字号 评论关闭

集群环境:

192.168.11.12 作为hbase主master

192.168.11.14 作为hbase备用master

 

192.168.11.16作为zookeeperNode/HRegionsever

192.168.11.18作为zookeeperNode/HRegionsever

192.168.11.20作为zookeeperNode/HRegionsever

 

192.168.11.12——192.168.11.20是hdfs的datanode

Hdfs的namenode为192.168.11.8主机名为hadoopNN00

 

软件版本:

Hadoop-0.20.1-dev

Hbase-0.90.3

 

Hbase的安装是基于hdfs的,Hbase的配置主要涉及conf目录下的三个文件:hbase-env.sh,hbase-site.xml,regionserver。

Hbase-env.sh配置如下:

#必须配置的项目如下:

export JAVA_HOME=/root/jdk1.6.0_25

export HBASE_OPTS="-ea -XX:+UseConcMarkSweepGC-XX:+CMSIncrementalMode"

export HBASE_MANAGES_ZK=true

exportHBASE_CLASSPATH=/usr/local/hadoop-0.20.1-dev/conf

调优配置项如下:

# Extra Java CLASSPATH elements.  Optional.

# export HBASE_CLASSPATH=

 

# The maximum amount of heap to use, in MB. Defaultis 1000.

# export HBASE_HEAPSIZE=1000

 

# Extra Java runtime options.

# Below are what we set by default.  May only work with SUN JVM.

# For more on why as well as other possiblesettings,

# seehttp://wiki.apache.org/hadoop/PerformanceTuning

export HBASE_OPTS="-ea -XX:+UseConcMarkSweepGC-XX:+CMSIncrementalMode"

 

# Uncomment below to enable java garbage collectionlogging.

# export HBASE_OPTS="$HBASE_OPTS -verbose:gc-XX:+PrintGCDetails -XX:+PrintGCDateStamps-Xloggc:$HBASE_HOME/logs/gc-hbase.log"

 

# Uncomment and adjust to enable JMX exporting

# See jmxremote.password and jmxremote.access in$JRE_HOME/lib/management to configure remote password access.

# More details at:http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html

#

# exportHBASE_JMX_BASE="-Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"

# export HBASE_MASTER_OPTS="$HBASE_JMX_BASE-Dcom.sun.management.jmxremote.port=10101-javaagent:lib/HelloWorldAgent.jar"

# exportHBASE_REGIONSERVER_OPTS="$HBASE_JMX_BASE-Dcom.sun.management.jmxremote.port=10102"

# export HBASE_THRIFT_OPTS="$HBASE_JMX_BASE-Dcom.sun.management.jmxremote.port=10103"

# export HBASE_ZOOKEEPER_OPTS="$HBASE_JMX_BASE-Dcom.sun.management.jmxremote.port=10104"

 

# File naming hosts on which HRegionServers willrun.  $HBASE_HOME/conf/regionservers bydefault.

# exportHBASE_REGIONSERVERS=${HBASE_HOME}/conf/regionservers

 

# Extra ssh options. Empty by default.

# export HBASE_SSH_OPTS="-o ConnectTimeout=1 -oSendEnv=HBASE_CONF_DIR"

 

# Where log files are stored.  $HBASE_HOME/logs by default.

# export HBASE_LOG_DIR=${HBASE_HOME}/logs

 

# A string representing this instance of hbase.$USER by default.

# export HBASE_IDENT_STRING=$USER

 

# The scheduling priority for daemon processes.  See 'man nice'.

# export HBASE_NICENESS=10

 

# The directory where pid files are stored. /tmp bydefault.

# export HBASE_PID_DIR=/var/hadoop/pids

 

# Seconds to sleep between slave commands.  Unset by default.  This

# can be useful in large clusters, where, e.g.,slave rsyncs can

# otherwise arrive faster than the master canservice them.

# export HBASE_SLAVE_SLEEP=0.1

 

# Tell HBase whether it should manage it's owninstance of Zookeeper or not.

 exportHBASE_MANAGES_ZK=true

 exportHBASE_CLASSPATH=/usr/local/hadoop-0.20.1-dev/conf

 

 

hbase-site.xml配置如下:

<?xml version="1.0"?>

<?xml-stylesheet type="text/xsl"href="configuration.xsl"?>

<configuration>

<property>

<name>hbase.rootdir</name>

<value>hdfs://hadoopNN00:9000/hbase</value>

<description>The directory shared by regionservers.</description>

</property>

<property>

<name>hbase.master.port</name>

<value>60000</value>

</property>

<property>

<name>hbase.cluster.distributed</name>

<value>true</value>

</property>

<property>

<name>hbase.zookeeper.property.dataDir</name>

<value>/usr/local/hbase/zookeeper</value>

</property>

<property>

<name>hbase.zookeeper.property.clientPort</name>

<value>2181</value>

</property>

<property>

<name>hbase.zookeeper.quorum</name>

<value>192.168.11.16,192.168.11.18,192.168.11.20</value>

</property>

</configuration>

其中,hbase.rootdir这一项的配置必须与hdfs的fs.name.default项一致,还要为hbase指定根目录/hbase

<property>

<name>hbase.rootdir</name>

<value>hdfs://hadoopNN00:9000/hbase</value>

<description>The directory shared by regionservers.</description>

</property>

Regionserver的配置如下:

192.168.11.16

192.168.11.18

192.168.11.20

 

配置完毕后将hbase拷贝到各个机器中的相同目录下。

 

启动habse

在192.168.11.12上启动hbase集群:bin/start-hbase.sh,首先启动的是zookeeper,再是master,最后是HRegionserver

抱歉!评论已关闭.