HBASE & ZK搭建

一、机器

配置/etc/hosts, 且ssh信任关系已配置

10.139.25.208 mhbase.sogou-in.domain mhbase
10.134.74.173 s1hbase.sogou-in.domain s1hbase
10.134.76.145 s2hbase.sogou-in.domain s2hbase

Node NameHMasterZKRegion Server
10.139.25.208yesyesno
10.134.74.173backupyesyes
10.134.76.145noyesyes

二、ZK搭建

ZK下载

解压后,配置文件 conf/zoo.cfg

tickTime=2000
dataDir=/data/zookeeper
clientPort=2181
initLimit=5
syncLimit=2
server.3=10.139.25.208:2888:3888
server.1=10.134.74.173:2888:3888
server.2=10.134.76.145:2888:3888

在三台机器上的,ZK的dataDir编辑myid,必须与zoo.cfg的序号一致

[root@mhbase zookeeper-3.4.8]# cat /data/zookeeper/myid
3

启动ZK
bin/zkServer.sh start

验证ZK
bin/zkServer.sh status

三、HBASE搭建

HBASE下载

解压后,配置文件conf/hbase-site.xml

<configuration>
<property>
  <name>hbase.zookeeper.quorum</name>
  <value>mhbase.sogou-in.domain,s1hbase.sogou-in.domain,s2hbase.sogou-in.domain</value>
</property>
<property>
  <name>hbase.zookeeper.property.dataDir</name>
  <value>/data/zookeeper</value>
</property>
<property>
  <name>hbase.cluster.distributed</name>
  <value>true</value>
</property>
<property>
  <name>hbase.rootdir</name>
  <value>hdfs://10.139.25.208:9000/hbase</value>
</property>
</configuration>

配置HMaster备机

[root@mhbase conf]# cat backup-masters
s1hbase.sogou-in.domain

配置Region Server

[root@mhbase conf]# cat regionservers
10.134.74.173
10.134.76.145

启动HBASE
bin/start-hbase.sh

验证HBASE:

[root@mhbase conf]# jps
20769 QuorumPeerMain
24437 Jps
18675 HMaster

[root@s1hbase zookeeper]# jps
14902 QuorumPeerMain
22192 HRegionServer
23528 Jps
22275 HMaster

[root@s2hbase zookeeper]# jps
13871 HRegionServer
25662 QuorumPeerMain
30082 Jps

登录zk shell 查看HBase APP
bin/zkCli.sh
zk: localhost:2181(CONNECTED) 3] ls /hbase
[meta-region-server, backup-masters, region-in-transition, draining, table, running, table-lock, master, namespace, hbaseid, online-snapshot, replication, recovering-regions, splitWAL, rs, flush-table-proc]

    原文作者:迷途的华生
    原文地址: https://www.jianshu.com/p/3f018442c241
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞