搭建3个节点的hadoop集群(完全分布式部署)--3 zookeeper与hbase安装

zookeeper安装比较顺利,hbase安装好后总是运行不了,HMaster起来马上又掉了,折腾了两天终于搞定,下面详细介绍下这两个组件的安装。

1.zookeeper

在apache官网下载zookeeper组件,我下载的版本是:zookeeper-3.4.10.tar.gz

scp上传到elephant节点的opt目录下面。

解压缩 tar -zxvf zookeeper-3.4.10.tar.gz

mv zookeeper-3.4.10 /opt/zookeeper

最终zookeeper的安装目录在/opt/zookeeper

#cp zoo_sample.cfg zoo.cfg                     
#vim zoo.cfg
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial 
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataDir=/opt/zookeeper/data   #与hbase中配置文件hbase-site.xml参数hbase.zookeeper.property.dataDir一致,
# the port at which the clients will connect
clientPort=2181

server.1=elephant:2888:3888
server.2=monkey:2888:3888
server.3=tiger:2888:3888

# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the 
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1

复制zookeeper文件到另外两个节点

scp /opt/zookeeper root@monkey:/opt/
scp /opt/zookeeper root@tiger:/opt/

启动zookeeper并查看状态

#./zkServer.sh start
#./zkServer.sh status

到此,zookeeper安装完成。

2.安装hbase

下载hbase安装文件,我下载的版本是hbase-1.2.6-bin.tar.gz

文件传到elephant节点的/opt目录

mv hbase-1.2.6-bin /opt/hbase

hbasede 安装目录为/opt/hbase

修改配置文件hbase-env.sh,设置hbase的运行环境

# vim hbase-env.sh
export JAVA_HOME=/opt/jdk1.8.0_121
export HBASE_PID_DIR=/opt/hbase/pids
export HBASE_CLASSPATH=/opt/hadoop-2.7.5/etc/hadoop
# Tell HBase whether it should manage it's own instance of Zookeeper or not.
export HBASE_MANAGES_ZK=false
设置hbase-site.xml
#vim hbase-site.xml

 
  hbase.rootdir 
  hdfs://192.168.205.136:9000/hbase
  
 
 
  hbase.cluster.distributed 
  true
 

     hbase.zookeeper.property.clientPort
     2181   
     Property from ZooKeeper's config zoo.cfg.
         The port at which the clients will connect.
       
  
 
  hbase.master 
  hdfs://elephant:60000
 
 
  hbase.zookeeper.quorum 
  elephant,monkey,tiger
     
 
  hbase.zookeeper.property.dataDir
  /opt/zookeeper/data
  
  
  hbase.tmp.dir
  /opt/hbase/tmpdata
  


设置 regionservers

#vim regionservers
monkey
tiger
修改环境变量
#vim /etc/profile

export JAVA_HOME=/opt/jdk1.8.0_121
export JRE_HOME=/opt/jdk1.8.0_121/jre
export HADOOP_HOME=/opt/hadoop-2.7.5
export HBASE_HOME=/opt/hbase
export ZOOKEEPER_HOME=/opt/zookeeper
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$ZOOKEEPER_HOME/bin:$HBASE_HOME/bin:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$HADOOP_HOME/bin:$PATH


#source etc/profile

jar包替换,为了避免版本兼容问题,我们需要把hadoop文件中所有hadoop*.jar替换hbase文件中lib目录下的相应hadoop*.jar包。

我们先cd 到 hadoop安装目录的jar包相关目录: rm -rf hadoop*.jar删掉所有的hadoop相关的jar包,然后运行:
find /home/hadoop/hadoop-2.2.0/share/hadoop -name "hadoop*jar" | xargs -i cp {} /home/hadoop/hbase-0.96.0-hadoop2/lib/ 
 拷贝所有hadoop2.2.0下的jar包hbase下进行hadoop版本的统一

然后把配置好的、opt/hbase文件夹scp到另外两个节点

#scp /opt/hbase root@monkey:/opt/
#scp /opt/hbase root@tiger:/opt/

到此,hbase安装完成。

启动hbase

#cd /opt/hbase

#bin/start-hbase.sh










你可能感兴趣的:(hadoop)