首页 > 大数据 > Hadoop > Linux Hbase安装
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
注释:的配置信息,由于本文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文件当中,修改如下配置
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.
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.
false: standalone and pseudo-distributed setups with managed Zookeeper
true: fully-distributed with unmanaged Zookeeper Quorum (see hbase-env.sh)
The port at which the clients will connect.
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.
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
Type "exit
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/ ,如需转载,请注明出处,否则将追究法律责任。