其他分享
首页 > 其他分享> > hadoop入门(4):部署zookeeper

hadoop入门(4):部署zookeeper

作者:互联网

1. 获取zookeeper

zookeeper3.6.3版本

2. 解压

tar -xvf apache-zookeeper-3.6.3-bin.tar -C /sjj/install/

3. 修改配置文件

主要修改了dataDir,autopurge,以及末尾追加了三行

  1 # The number of milliseconds of each tick
  2 tickTime=2000
  3 # The number of ticks that the initial 
  4 # synchronization phase can take
  5 initLimit=10
  6 # The number of ticks that can pass between 
  7 # sending a request and getting an acknowledgement
  8 syncLimit=5
  9 # the directory where the snapshot is stored.
 10 # do not use /tmp for storage, /tmp here is just 
 11 # example sakes.
 12 dataDir=/sjj/install/apache-zookeeper-3.6.3-bin/zkdatas
 13 # the port at which the clients will connect
 14 clientPort=2181
 15 # the maximum number of client connections.
 16 # increase this if you need to handle more clients
 17 #maxClientCnxns=60
 18 #
 19 # Be sure to read the maintenance section of the 
 20 # administrator guide before turning on autopurge.
 21 #
 22 # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
 23 #
 24 # The number of snapshots to retain in dataDir
 25 autopurge.snapRetainCount=3
 26 # Purge task interval in hours
 27 # Set to "0" to disable auto purge feature
 28 autopurge.purgeInterval=1
 29 
 30 ## Metrics Providers
 31 #
 32 # https://prometheus.io Metrics Exporter
 33 #metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
 34 #metricsProvider.httpPort=7000
 35 #metricsProvider.exportJvmInfo=true
 36 
 37 # 追加三行
 38 server.1=node001:2888:3888
 39 server.2=node002:2888:3888
 40 server.3=node003:2888:3888

4. 添加myid配置

cd /sjj/install/apache-zookeeper-3.6.3-bin/zkdatas
echo 1 > /sjj/install/apache-zookeeper-3.6.3-bin/zkdatas/myid

5. 安装包分发

scp -r /sjj/install/apache-zookeeper-3.6.3-bin/ node002:/sjj/install/
scp -r /sjj/install/apache-zookeeper-3.6.3-bin/ node003:/sjj/install/

6. 修改其余两台机器的myid

echo 2 > /sjj/install/apache-zookeeper-3.6.3-bin/zkdatas/myid

echo 3 > /sjj/install/apache-zookeeper-3.6.3-bin/zkdatas/myid

7. 配置环境变量(三台机器都需要

sudo vim /etc/profile

# zookeeper环境配置
export ZK_HOME=/sjj/install/apache-zookeeper-3.6.3-bin
export PATH=$PATH:$ZK_HOME/bin

source /etc/profile

7. 启动zookeeper服务

8. 注意

关闭必须先关zookeeper再关虚拟机最后关闭电脑,不然很容易出错

标签:bin,3.6,入门,zookeeper,hadoop,sjj,install,apache
来源: https://www.cnblogs.com/S2Jgogo/p/15888476.html