一、安装包

  1、下载最新版(3.4.13):https://archive.apache.org/dist/zookeeper/  下载https://archive.apache.org/dist/zookeeper/zookeeper-3.4.13/zookeeper-3.4.13.tar.gz解压开即可。本文中解压到/opt目录下。

二、环境

  1、三台服务器IP分别为:192.168.1.104、192.168.1.105、192.168.1.106

  2、三台的Zookeeper配置文件路径都是:/opt/zookeeper/zookeeper-3.4.13/conf/zoo.cfg

三、配置集群:

  1、服务器192.168.1.104中:

  (1)修改/opt/zookeeper/zookeeper-3.4.13/conf/zoo.cfg文件内容如下:

# The number of milliseconds of each tick
tickTime=
# The number of ticks that the initial
# synchronization phase can take
initLimit=
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/opt/zookeeper/zkdata/data
dataLogDir=/opt/zookeeper/zkdata/log
# the port at which the clients will connect
clientPort=
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=
#
# 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=
# Purge task interval in hours
# Set to "" to disable auto purge feature
#autopurge.purgeInterval= server.=0.0.0.0::
server.=192.168.6.105::
server.=192.168.6.106::

  (2)创建目录并配置myid。

    I、创建目录:/opt/zookeeper/zkdata/data

    II、创建文件:/opt/zookeeper/zkdata/data/myid ,内容为"104"  ,或者使用命令快速生成:

echo 104>/opt/zookeeper/zkdata/data/myid

  2、服务器192.168.1.105中:

  (1)修改/opt/zookeeper/zookeeper-3.4.13/conf/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/zkdata/data
dataLogDir=/opt/zookeeper/zkdata/log
# 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 server.104=192.168.6.104:2888:3888
server.105=0.0.0.0:2888:3888
server.106=192.168.6.106:2888:3888

  (2)创建目录并配置myid。

    I、创建目录:/opt/zookeeper/zkdata/data

    II、创建文件:/opt/zookeeper/zkdata/data/myid ,内容为"105"  ,或者使用命令快速生成:

echo 105>/opt/zookeeper/zkdata/data/myid

  3、服务器192.168.1.106中:

  (1)修改/opt/zookeeper/zookeeper-3.4.13/conf/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/zkdata/data
dataLogDir=/opt/zookeeper/zkdata/log
# 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 server.104=192.168.6.104:2888:3888
server.105=192.168.6.105:2888:3888
server.106=0.0.0.0:2888:3888

  (2)创建目录并配置myid。

    I、创建目录:/opt/zookeeper/zkdata/data

    II、创建文件:/opt/zookeeper/zkdata/data/myid ,内容为"106"  ,或者使用命令快速生成:

echo 106>/opt/zookeeper/zkdata/data/myid

四、三台机器中,都为防火墙中添加2181、2888、3888端口入站。

添加端口:
  firewall-cmd --zone=public --add-port=/tcp --permanent
  firewall-cmd --zone=public --add-port=/tcp --permanent
  firewall-cmd --zone=public --add-port=/tcp --permanent
重新载入:
  firewall-cmd --reload

五、启动Zookeeper:三台机器中依次运行

/opt/zookeeper/zookeeper-3.4./bin/zkServer.sh start /opt/zookeeper/zookeeper-3.4./conf/zoo.cfg

在三台Centos或Windows中部署三台Zookeeper集群配置的更多相关文章

  1. Centos或Windows中部署Zookeeper集群及其简单用法

    一.简介 ZooKeeper是一个分布式的,开放源码的分布式应用程序协调服务,是Google的Chubby一个开源的实现,是Hadoop和Hbase的重要组件.它是一个为分布式应用提供一致性服务的软件 ...

  2. 分布式架构中一致性解决方案——Zookeeper集群搭建

    当我们的项目在不知不觉中做大了之后,各种问题就出来了,真jb头疼,比如性能,业务系统的并行计算的一致性协调问题,比如分布式架构的事务问题, 我们需要多台机器共同commit事务,经典的案例当然是银行转 ...

  3. China Azure中部署Kubernetes(K8S)集群

    目前China Azure还不支持容器服务(ACS),使用名称"az acs create --orchestrator-type Kubernetes -g zymtest -n kube ...

  4. 10分钟学会windows中iis搭建服务器集群实现负载均衡和nginx代理转发

    前言 我们之前聊过 10分钟搭建服务器集群--Windows7系统中nginx与IIS服务器搭建集群实现负载均衡:https://www.cnblogs.com/xiongze520/p/103087 ...

  5. windows server 2012R2 故障转移集群配置

    配置说明: AD:10.10.1.10/24  Node-2:10.10.1.20/24 Node-3:10.10.1.30/24 zhangsan-PC:10.10.1.50/24  VIP1:10 ...

  6. Centos6下zookeeper集群部署记录

    ZooKeeper是一个开放源码的分布式应用程序协调服务,它包含一个简单的原语集,分布式应用程序可以基于它实现同步服务,配置维护和命名服务等. Zookeeper设计目的 最终一致性:client不论 ...

  7. windows下zookeeper集群安装

    windows下zookeeper单机版安装,见:https://www.cnblogs.com/lbky/p/9867899.html 一:zookeeper节点为什么是奇数个? 单机模式的zk进程 ...

  8. K8S部署Redis Cluster集群

    kubernetes部署单节点redis: https://www.cnblogs.com/zisefeizhu/p/14282299.html Redis 介绍 • Redis代表REmote DI ...

  9. K8S部署Redis Cluster集群(三主三从模式) - 部署笔记

    一.Redis 介绍 Redis代表REmote DIctionary Server是一种开源的内存中数据存储,通常用作数据库,缓存或消息代理.它可以存储和操作高级数据类型,例如列表,地图,集合和排序 ...

随机推荐

  1. Java 之 Web前端(一)

    1.http a.定义:超文本传输协议 b.作用:web服务器与web浏览器之间通信 c.步骤: ①客户端与web服务器建立连接(IP地址与端口号) ②客户端发送http请求(请求资源路径) ③服务器 ...

  2. 问题 L: An Invisible Hand - (2018年第二阶段个人训练赛第三场)

    题目描述 There are N towns located in a line, conveniently numbered 1 through N. Takahashi the merchant ...

  3. Python Pexpect库的简单使用

    Python Pexpect库的使用 简介 最近需要远程操作一个服务器并执行该服务器上的一个python脚本,查到可以使用Pexpect这个库.记录一下. 什么是Pexpect?Pexpect能够产生 ...

  4. SpringBoot使用Mybatis-PageHelper

    前言 之前一篇文章介绍了<SpringBoot+Mybatis+MySql学习>的整合,这一片扩展一下Mybatis的分页插件-Mybatis-PageHelper. 新建项目 首先,po ...

  5. BZOJ.4910.[SDOI2017]苹果树(树形依赖背包 DP 单调队列)

    BZOJ 洛谷 \(shadowice\)已经把他的思路说的很清楚了,可以先看一下会更好理解? 这篇主要是对\(Claris\)题解的简单说明.与\(shadowice\)的做法还是有差异的(比如并没 ...

  6. git clean使用总结

    git clean移除工作区中untracked的文件(即:需要先add).一直都是用rm来操作……

  7. Django——ModuleNotFoundError: No module named 'asgiref.sync'

    Django+channels运行时报错 Unhandled exception in thread started by <function check_errors.<locals&g ...

  8. 如何绘制UML图?

    首先推荐在线绘制UML的网址:https://www.processon.com/,很好用. 在软件开发过程中,开发人员往往需要通过绘制类图来理清业务的实现思路,从而方便代码实现,也便于后期的代码维护 ...

  9. JS内存管理

    背景: 分配给Web浏览器的内存通常比分配给电脑桌面的内存少,因为担心运行JS的网页耗尽全部系统内存而导致系统崩溃 内存限制问题不仅影响给变量分配内存,还会影响调用栈以及在一个线程中能够同时执行的语句 ...

  10. DeepCas:an end-to-end predictorof information Cascades