zookeper安装_ZooKeeper安装

一、Zookeeper简介与应用场景

Zookeeper 是一个开源的分布式的,为分布式应用提供协调服务的 Apache 项目.提供的服务包括:统一命名服务、统一配置管理、统一集群管理、服务器节点动态上下线、软负载均衡等.

Zookeeper的主要有单机、伪集群、集群三种部署方式.

二、官网下载Linux版本的Zookeeper,下载好的Zookeeper上传到Linux系统上(上传到 /opt下面,主要是放在这里备份一下)

三、创建一个安装目录(我这里想安装在 /usr/local/zookeeper下面)

四、解压

1、切换到 /opt目录下面,然后执行命令解压

// 解压文件到 /usr/local/zookeeper目录下

tar -zxvf zookeeper-3.4.14.tar.gz -C /usr/local/zookeeper

2、解压后的目录结构如下

五、创建配置文件

1、创建一个zookeeper的配置文件zoo.cfg,可复制conf/zoo_sample.cfg作为配置文件

2、zoo.cfg配置文件简介

# The number of milliseconds of each tick

# tickTime:客户端与服务器、服务器与服务器之间维持心跳的时间间隔,也就是每一个tickTime会发送一次心跳,单位为毫秒

#

tickTime=2000

#

# The number of ticks that the initial

# synchronization phase can take

# initLimit:集群中Leader和Follow初始化连接时最多能容忍的心跳数

# 也就是初始化过程中,如果Leader和Follow在 (10*tickTime)的时间内还没有连接上,则认为连接失败

initLimit=10

#

# The number of ticks that can pass between

# sending a request and getting an acknowledgement

# syncLimit:同步通信实现,Leader和Follow服务器之间发送请求和接收应答最多能容忍的心跳数

# 也就是Leader和Follow如果发送的请求在 (5*tickTime)的时间没没有应答,那么就认为Leader和Follow之间连接失败

#

syncLimit=5

#

# the directory where the snapshot is stored.

# do not use /tmp for storage, /tmp here is just

# example sakes.

# dataDir:zookeeper保存日志文件的目录

#

dataDir=/tmp/zookeeper

#

# the port at which the clients will connect

# clientPort:客户端连接zookeeper服务器的端口,zookeeper会监控这个端口

#

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

# 集群信息规则(server.服务器编号=服务器的IP地址:LF通信端口:选举端口

# server.N=YYY:A:B

# N:服务器编号,每一台服务器的编号都是唯一的

# YYY:服务器的IP地址

# A:LF通信的端口,服务器与zookeeper集群中Leader交换信息的端口

# B:选举端口,集群中每一台服务器的A端口都是一样的,集群中的每一台服务器的B端口也是一样的

# 但是当采用伪集群的时候,由于IP地址都是一样的,只能是A端口和B端口不一样.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值