ITPub博客

首页 > 大数据 > Hadoop > Linux Hbase安装

Linux Hbase安装

原创 Hadoop 作者:百联达 时间:2014-03-07 15:40:22 0 删除 编辑
一:环境准备

服务器:hadoop-master,hadoop-slave01,hadoop-slave02
hbase版本:hbase-0.94.17.tar.gz

HBase自带了Zookeeper,但为了方便其他应用程序使用Zookeeper 在这里使用单独安装的Zookeeper集群。

Hadoop集群,Zookeeper集群,HBase集群是三个互相独立的集群,并不需要部署在相同的物理节点上,他们之间是通过网络通信的。

二:安装
tar -zxvf hbase-0.94.17.tar.gz -C /usr/local
chown -R hadoop:hadoop /usr/local/hbase-0.94.17

hbase的版本需要与hadoop对应,查看是否对应只需要看hbase-0.94.17/lib/hadoop-core后面的版本号是否与hadoop的版本对应,如果不对应,可以将hadoop下hadoop-core文件复制过来,但是不能保证不会有问题

三:参数配置

 切换到hadoop用户下

 su - hadoop

1.配置hbase-env.sh文件(/usr/local/hbase-0.94.17/conf)

export JAVA_HOME=/usr/local/jdk1.7.0_40

export HBASE_CLASSPATH=/usr/local/hadoop-1.2.1/conf

export HBASE_MANAGES_ZK=false

export HBASE_HEAPSIZE=2048

注释:
HBASE_CLASSPATH指向存放有Hadoop配置文件的目录,这样HBase可以找到HDFS

的配置信息,由于本文Hadoop和HBase部署在相同的物理节点,所以就指向了Hadoop安

装路径下的conf目录。HBASE_HEAPSIZE单位为MB,可以根据需要和实际剩余内存设置,

默认为1000。HBASE_MANAGES_ZK=false指示HBase使用已有的Zookeeper而不是自带的。

2.配置 hbase-site.xml文件
将hbase-0.94.17/src/main/resources/hbasse-default.xml文件 复制到conf的hbase-site.xml文件当中,修改如下配置

 

   hbase.rootdir</name>

   hdfs://hadoop-master:9000/hbase

   The directory shared by region servers.

 

 

   hbase.hregion.max.filesize

   1073741824

   

   Maximum HStoreFile size. If any one of a column families' HStoreFiles has

   grown to exceed this value, the hosting HRegion is split in two.

   Default: 256M.

   

 

 

   hbase.hregion.memstore.flush.size

   134217728

   

   Memstore will be flushed to disk if size of the memstore

   exceeds this number of bytes.  Value is checked by a thread that runs

   every hbase.server.thread.wakefrequency.

   

 

 

   hbase.cluster.distributed

   true

   The mode the cluster will be in. Possible values are

     false: standalone and pseudo-distributed setups with managed Zookeeper

     true: fully-distributed with unmanaged Zookeeper Quorum (see hbase-env.sh)

 

 

     hbase.zookeeper.property.clientPort

     2181

     Property from ZooKeeper's config zoo.cfg.

     The port at which the clients will connect.

     

 

 

   zookeeper.session.timeout

   120000

 

 

   hbase.zookeeper.property.tickTime

   6000

 

   

     hbase.zookeeper.quorum

     hadoop-maste,hadoop-slave01,hadoop-02

     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.

     

       hbase.tmp.dir

       /data/hadoop/hbase

   

 
    hbase.defaults.for.version.skip
    true
   
    Set to true to skip the 'hbase.defaults.for.version' check.
    Setting this to true can be useful in contexts other than
    the other side of a maven generation; i.e. running in an
    ide.  You'll want to set this boolean to true to avoid
    seeing the RuntimException complaint: "hbase-default.xml file
    seems to be for and old version of HBase (@@@VERSION@@@), this
    version is X.X.X-SNAPSHOT"
   

 

注释:

1,hbase.rootdir:hbase所使用的文件系统为HDFS,根目录为hdfs://node0:9000/hbase,该目录应该由HBase自动创建,只需要指定到正确的HDFS NameNode上即可。

2,hbase.hregion.max.filesize:设置HStoreFile的大小,当 大于这个数时,就会split 成两个文件

3,hbase.hregion.memstore.flush.size:设置memstore的大小,当大于这个值时,写入磁盘

4,hbase.cluster.distributed:指定hbase为分布式模式

5,hbase.zookeeper.property.clientPort:指定zk的连接端口

6,zookeeper.session.timeout:RegionServer与Zookeeper间的连接超时时间。当超时时间到后,ReigonServer会被Zookeeper从RS集群清单中移除,HMaster收到移除通知后,会对这台server负责的regions重新balance,让其他存活的RegionServer接管.

7,hbase.zookeeper.property.tickTime:

8,hbase.zookeeper.quorum:默认值是 localhost,列出zookeepr的ensemble servers

9,hbase.regionserver.handler.count:
默认值:10
说明:RegionServer的请求处理IO线程数。
调优:
这个参数的调优与内存息息相关。
较少的IO线程,适用于处理单次请求内存消耗较高的Big PUT场景(大容量单次PUT或设置了较大cache的scan,均属于Big PUT)或ReigonServer的内存比较紧张的场景。
较多的IO线程,适用于单次请求内存消耗低,TPS要求非常高的场景。设置该值的时候,以监控内存为主要参考。
这里需要注意的是如果server的region数量很少,大量的请求都落在一个region上,因快速充满memstore触发flush导致的读写锁会影响全局TPS,不是IO线程数越高越好。
压测时,开启Enabling RPC-level logging,可以同时监控每次请求的内存消耗和GC的状况,最后通过多次压测结果来合理调节IO线程数。
这里是一个案例?Hadoop and HBase Optimization for Read Intensive Search Applications,作者在SSD的机器上设置IO线程数为100,仅供参考。

10,hbase.tmp.dir:指定HBase将元数据存放路径


3.配置regionservers  

hadoop-slave01

hadoop-slave02

四:启动与关闭
bin/start-hbase.sh
bin/stop-hbase.sh

五:测试

 bin/hbase shell

HBase Shell; enter 'help' for list of supported commands.

Type "exit" to leave the HBase Shell

Version 0.94.12, r1524863, Fri Sep 20 04:44:41 UTC 2013


hbase(main):001:0>

创建一个名为 tbTest的表,这个表只有一个 column family 为 testF。可以列出所有的表来检查创建情况,然后插入些值。

hbase(main):003:0> create 'tbTest', 'testF
0 row(s) in 1.2200 seconds
hbase(main):003:0> list
tbTest

1 row(s) in 0.0550 seconds



 六:监控

用于访问和监控Hadoop系统运行状态


Daemon

缺省端口

配置参数

HDFS

Namenode

50070

dfs.http.address

Datanodes

50075

dfs.datanode.http.address

Secondarynamenode

50090

dfs.secondary.http.address

Backup/Checkpoint node*

50105

dfs.backup.http.address

MR

Jobracker

50030

mapred.job.tracker.http.address

Tasktrackers

50060

mapred.task.tracker.http.address

HBase

HMaster

60010

hbase.master.info.port

HRegionServer

60030

hbase.regionserver.info.port

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/28624388/viewspace-1103139/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: linux Node.js安装
请登录后发表评论 登录
全部评论
15年以上互联网经验,先后从事过制造业,证券业,物业行业和物流行业信息系统和互联网产品的设计落地实施,8年系统架构经验。最近关注企业数字化转型、财务数字化服务共享、大语言模型、Kubernetes微服务架构和Istio微服务治理框架。

注册时间:2013-02-05

  • 博文量
    332
  • 访问量
    1265615