zookeeper安装

下载

官网:http://archive.apache.org/dist/zookeeper/zookeeper-3.4.6/.

安装步骤记录

解压

tar -zxvf zookeeper-3.4.14.tar.gz

复制配置文件

cp zoo_sample.cfg zoo.cfg

配置myid存放位置

配置系统环境变量

vi /etc/profile
在文件的末尾添加如下的的东西 注意文件的位置
export ZOOKEEPER=/usr/local/zookeeper
export PATH=$PATH:$ZOOKEEPER/bin
source /etc/profile

启动

因为配置了环境变量,所以在任意目录下都可以运行以下启动命令启动Zookeeper。
在这里插入图片描述

zkServer.sh start //启动
zkServer.sh status  //查看运行状态
zkCli.sh   //启动客户端

配置文件说明

初始的配置文件信息

# The number of milliseconds of each tick
tickTime=2000
# CS通信心跳时间 默认是2000 毫秒 客户端和服务端 可以通过心跳机制检测存活的状态,还可以通过心跳来控制  # Flower跟Leader的通信时间(集群相关的东西吧),默认情况下FL的会话时常是心跳间隔的两倍。
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# 集群中的follower服务器(F)与leader服务器(L)之间初始连接时能容忍的最多心跳数(tickTime的数量)
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# 集群中flower服务器(F)跟leader(L)服务器之间的请求和答应最多能容忍的心跳数。
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/tmp/zookeeper
# 该属性对应的目录是用来存放myid信息跟一些版本,日志,跟服务器唯一的ID信息等。
# the port at which the clients will connect
clientPort=2181
# 客户端访问的接口
# 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

集群信息的配置
在zoo.cfg这个文件中,配置集群信息是存在一定的格式:service.N =YYYAB

N:代表服务器编号(也就是myid里面的值dataDir指明了这个存储在什么位置,所需需要明确这个文件的位置)

YYY:服务器地址

A:表示 Flower 跟 Leader的通信端口,简称服务端内部通信的端口(默认2888B:表示 是选举端口(默认是3888)

server.1=hadoop05:2888:3888
server.2=hadoop06:2888:3888
server.3=hadoop07:2888:3888

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值