一、安装包

  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. Linux 常用基本指令

    1.ls 参数: -a:列出所有目录(“.”开头的是隐藏文件) -l: 以长格式列出目录下的内容列表 2.cd cd  切换到家目录 cd ~ 切换到家目录 cd .. 切换到上一级目录 3.pwd ...

  2. Mybatis if test 中int integer判断非空的坑

    Mybatis 中,alarmType 是int类型.如果alarmType 为0的话,条件判断返回结果为false,其它值的话,返回true. 1 <if test="alarmTy ...

  3. VS2017 下载离线MSDN文档

    VS2017 下载离线MSDN文档 点开帮助窗口的时候发现没有添加和删除帮助内容选项.处理方法如下: 1.打开vs2017安装包,如果你找不到安装包,可在相应你下载vs2017的浏览器上找到下载内容, ...

  4. Qt5.11.1安装与VS2017配置

    Qt5.11.1安装与VS2017配置 转 https://blog.csdn.net/gaojixu/article/details/82185694 文章目录 Qt5.11.1安装与VS2017配 ...

  5. .NET Core 2.0应用程序大小减少50%

    .NET Core 2.0应用程序减小体积瘦身官方工具 IL Linker. IL Linker 来源于mono的linker  https://github.com/mono/linker,目前还是 ...

  6. shell脚本中的set -e和set -o pipefail

    工作中经常在shell脚本中看到set的这两个用法,但就像生活中的很多事情,习惯导致忽视,直到出现问题才引起关注. 1. set -eset命令的-e参数,linux自带的说明如下:"Exi ...

  7. P=(1+1/(1-L))/2

    1 y=1/x 2 y=1/(1-x) 3 4

  8. 如何在github上搭建网站?

    3年前就想写这篇文章了,一直没写,拖到现在,迟到总比不到好,哈哈.github pages只支持静态博客(html,css,js),不支持服务端(php,physon). 一.尝试一下 1.在电脑上安 ...

  9. npm、webpack、vue-cli 快速上手版

    Node.js   npm 什么是Node.js  以及npm 简单的来说 Node.js 就是运行在服务端的JavaScript,基于Chrome V8 引擎的. npm 是Node.js 的包管理 ...

  10. BZOJ.1312.[Neerc2006]Hard Life(分数规划 最大权闭合子图)

    BZOJ 最大密度子图. 二分答案\(x\),转为求是否存在方案满足:\(边数-x*点数\geq 0\). 选一条边就必须选两个点,所以可以转成最大权闭合子图.边有\(1\)的正权,点有\(x\)的负 ...