---
title: "hbase-- Fully Distributed Install"
author: "oracle_api"
date: "2017-07-11T19:33:07Z"
tags: []
categories: ["开源软件"]
slug: "hbase-fully-distributed-install"
draft: false
lastmod: "2017-07-11T19:33:07Z"
id: 2384107
url: "https://oracle-api.iteye.com/blog/2384107"
---

NodeName Master     ZooKeeper RegionServer

centos1       yes          yes             no

centos2       backup    yes             yes

centos3       no            yes             yes

 

 

1\. config hbase

1.0 ~/.bashrc

export HBASE\_HOME=/usr/local/hbase

export PATH=:$HBASE\_HOME/bin

scp ~/.bashrc root@centos2:~/.bashrc

scp ~/.bashrc root@centos3:~/.bashrc

source ~/.bashrc

 

1.1 hbase-site.xml

```
<property>
  <name>hbase.cluster.distributed</name>
  <value>true</value>
</property>
<property>
  <name>hbase.rootdir</name>
  <!--hdfs://centos1:9000 is the value of fs.default.name in hdfs-site.xml under hadoop config folder-->
  <value>hdfs://centos1:9000/hbase</value> 
</property>

<!-- This configuration will direct HBase to start and manage a ZooKeeper instance on each node of the cluster. -->
<property>  
  <name>hbase.zookeeper.quorum</name>
  <value>centos1,centos2,centos3</value>
  <!--if each server has different port, the value could be centos1:2181,centos2:2181,centos3:2182  -->
</property>
<property>
  <name>hbase.zookeeper.property.dataDir</name>
  <value>/root/data/hbase/zookeeper</value>
</property>
```

 

 

1.2 conf/regionservers

centos2

centos3

 

1.3 conf/backup-masters

centos2

 

 

2\. copy /usr/local/hbase to centos2 and centos3

scp -r /usr/local/hbase root@centos2:/usr/local/

scp -r /usr/local/hbase root@centos3:/usr/local/

 

 

3.Start Hbase on centos1

start-hbase.sh

 

 

4\. run JPS on each server

centos1

20071 HQuorumPeer

20137 HMaster

centos2

15930 HRegionServer

15838 HQuorumPeer

16010 HMaster

centos3

13639 HQuorumPeer

13737 HRegionServer

 

 

5\. Test webpage

http://centos1:16010/  master

http://centos2:16010/  secondary master

http://centos2:16030/  RegionServers

http://centos3:16030/  RegionServers

 

 

6\. Tell HBase whether it should manage it's own instance of Zookeeper or not. 

vi /usr/local/hbase/conf/hbase-env.sh

    export HBASE\_MANAGES\_ZK=false

scp /usr/local/hbase/conf/hbase-env.sh root@centos2:/usr/local/hbase/conf/hbase-env.sh

scp /usr/local/hbase/conf/hbase-env.sh root@centos3:/usr/local/hbase/conf/hbase-env.sh