Hadoop环境配置(7)-zookeeper搭建

zookeeper搭建前提关闭防火墙

1.将zookeeper安装包拖至cd /opt/software文件夹下

2.解压zookeeper到cd /opt/module/文件夹下

  1. cd /opt/software/

  2. tar -zxvf apache-zookeeper-3.5.5-bin.tar.gz -C /opt/module/

3.在解压后的zookeeper文件夹下,创建log文件夹和data文件夹

  1. cd /opt/module/apache-zookeeper-3.5.7-bin/

  2. mkdir data

  3. mkdir log

4.拷贝配置文件

  1. cd /opt/module/apache-zookeeper-3.5.7-bin/conf/

  2. cp zoo_sample.cfg zoo.cfg

5.配置文件更改

vi zoo.cfg

 

将如下内容添加到编辑面板中:

  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=/opt/module/apache-zookeeper-3.5.5-bin/data

  13. dataLogDir=/opt/module/apache-zookeeper-3.5.5-bin/log

  14. the port at which the clients will connect

  15. clientPort=2181

  16. the maximum number of client connections.

  17. increase this if you need to handle more clients

  18. #maxClientCnxns=60

  19. #

  20. Be sure to read the maintenance section of the

  21. administrator guide before turning on autopurge.

  22. #

  23. #http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance

  24. #

  25. The number of snapshots to retain in dataDir

  26. #autopurge.snapRetainCount=3

  27. Purge task interval in hours

  28. Set to "0" to disable auto purge feature

  29. #autopurge.purgeInterval=1

  30. server.0=192.168.1.100:2888:3888

  31. server.1=192.168.1.101:2888:3888

  32. server.2=192.168.1.102:2888:3888

6.创建服务器myid

在data目录下创建一个myid的文件,里面的值可以给个任意的值,但要和上述服务起server.x对应

  1. cd /opt/module/apache-zookeeper-3.5.7-bin/data/

  2. touch myid

 

 7.集群拷贝

  1. scp -r /opt/module/apache-zookeeper-3.5.5-bin root@hadoop101:/opt/module/apache-zookeeper-3.5.5-bin

  2. scp -r /opt/module/apache-zookeeper-3.5.5-bin root@hadoop102:/opt/module/apache-zookeeper-3.5.5-bin

8.集群myid更改

进入每个节点进行更改myid的值

Hadoop101改为1

Hadoop102改为2

9.添加系统环境变量

vi /etc/profile

在编辑面板中添加如下内容

  1. export ZOOKEEPER_HOME=/opt/module/apache-zookeeper-3.5.7-bin

  2. export PATH=$PATH:$ZOOKEEPER_HOME/bin

然后

source /etc/profile

10.集群启动

进入到每个节点启动

  1. cd /opt/module/apache-zookeeper-3.5.5-bin

  2. zkServer.sh start

  3. zkServer.sh status

启动zkServer.sh satus时,要先找到leader,leader可能在3个服务器之中的某一个里

所以现在每个服务器中启动一下找到leader,然后再启动另外的服务器

11.zkCli连接验证

zkCli.sh -server hadoop100:2181

然后jps查看进程

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值