• 【Zookeeper】Win平台伪集群搭建


    下载稳定版Zookeeper

    https://downloads.apache.org/zookeeper/stable/

    GZ包:

    apache-zookeeper-3.6.3-bin.tar.gz 

    解压一份到本地磁盘中

    1、将conf目录下的zoo_sample.cfg复制一份改名为zoo.cfg

    2、更改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=D:\\develop\\ZookeeperCluster\\apache-zookeeper-3.5.9-2\\data
    # the port at which the clients will connect
    clientPort=2182
    # 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.1 = 127.0.0.1:2184:3887
    server.2 = 127.0.0.1:2185:3888
    server.3 = 127.0.0.1:2186:3889

    由于是在一台机器上部署三个Zookeeper实例,必然占用系统很多端口资源

    每个实例的客户端口不能一致,服务端口和选举端口也不能一致

    1个实例占用 3个端口 (客户端口 + 服务端口 + 选举端口)

    然后把Zookeeper的目录复制2份出来,分别重命名以区分

    apache-zookeeper-3.5.9-1
    apache-zookeeper-3.5.9-2
    apache-zookeeper-3.5.9-3

    写入服务ID标识

    ECHO 1 > %CD%\ZookeeperCluster\apache-zookeeper-3.5.9-1\data\myid
    ECHO 2 > %CD%\ZookeeperCluster\apache-zookeeper-3.5.9-2\data\myid
    ECHO 3 > %CD%\ZookeeperCluster\apache-zookeeper-3.5.9-3\data\myid

    更改 apache-zookeeper-3.5.9-2 的zoo.cfg 客户端端口为 2182

    更改 apache-zookeeper-3.5.9-3 的zoo.cfg 客户端端口为 2183

    clientPort=2181
    clientPort=2182
    clientPort=2183

    为了方便启动,可以编写集群启动脚本:

    @ECHO OFF
    start %CD%\apache-zookeeper-3.5.9-1\bin\zkServer.cmd
    start %CD%\apache-zookeeper-3.5.9-2\bin\zkServer.cmd
    start %CD%\apache-zookeeper-3.5.9-3\bin\zkServer.cmd
  • 相关阅读:
    Docker学习重点(5)~Docker镜像原理、commit提交镜像
    Docker学习重点(6)~容器数据卷
    Linux安装RocketMQ
    4.1 打包和压缩的概念和区别
    4.3 Linux压缩文件或目录为.zip格式(zip命令)
    3.21 Linux PATH环境变量及作用(初学者必读)
    4.6 Linux解压.gz格式的文件(gunzip命令)
    4.4 Linux解压.zip格式的文件(unzip命令)
    3.18 Linux懒人神器:命令自动补全功能!
    4.5 Linux压缩文件或目录中文件为.gz格式(gzip命令)
  • 原文地址:https://www.cnblogs.com/mindzone/p/15964138.html
Copyright © 2020-2023  润新知