zoukankan      html  css  js  c++  java
  • windows下zookeeper集群的搭建

    了解zk

    这里面有windows下简单的搭建:
    https://blog.csdn.net/qq_38366063/article/details/92007458

    搭建集群版本

    先将zk考三份
    在这里插入图片描述
    然后进入conf里面修改zoo.cfg
    第一个里面0:

    # The number of milliseconds of each tick
    tickTime=2000
    
    initLimit=10
    
    syncLimit=5
    
    dataDir=E:/zookeeper_study/tmp/zookeeper/data
    # the port at which the clients will connect
    clientPort=2181
    server.1=localhost:2881:3881
    server.2=localhost:2882:3882
    server.3=localhost:2883:3883
    

    第一个里面1:zoo.cfg:

    # The number of milliseconds of each tick
    tickTime=2000
    
    initLimit=10
    
    syncLimit=5
    
    dataDir=E:/zookeeper_study/tmp/zookeeper/data1
    # the port at which the clients will connect
    clientPort=2182
    server.1=localhost:2881:3881
    server.2=localhost:2882:3882
    server.3=localhost:2883:3883
    

    2里面:

    # The number of milliseconds of each tick
    tickTime=2000
    
    initLimit=10
    
    syncLimit=5
    
    dataDir=E:/zookeeper_study/tmp/zookeeper/data2
    # the port at which the clients will connect
    clientPort=2183
    server.1=localhost:2881:3881
    server.2=localhost:2882:3882
    server.3=localhost:2883:3883
    
    

    因为是伪集群,都是在本机上面,所以…
    server参数说明:
    server.A=B:C:D配置项
    A:这是一个数字,表示这是第几号服务器
    B:A服务器的IP地址
    C:通讯端口,即A服务器与集群中的 Leader 服务器交换信息的端口
    D:选举通讯端口,表示的是万一集群中的 Leader 服务器挂了,需要一个端口来重新进行选举,选出一个新的 Leader,而这个端口就是用来执行选举时服务器相互通信的端口。如果是伪集群的配置方式,由于 B 都是一样,所以不同的 Zookeeper 实例通信端口号不能一样,所以要给它们分配不同的端口号。

    然后在每个dataDir目录下建一个myid文件,文件里面就一个数字
    在这里插入图片描述
    在这里插入图片描述
    一开始启动第一个会一直报错,不管它,都启动成功就不报错了…
    在这里插入图片描述
    每个里面会有myid:2,可以区分,其实在启动的时候会一直报当前状态looking,你这时候是连接不上去的.
    图形化界面:https://blog.csdn.net/qq_38366063/article/details/93495348
    都启动成功拿图形化界面连接2181
    在这里插入图片描述
    在这里插入图片描述

    同理,连接2182,2183都是没问题的.
    linux跟windows几乎一样.我参考的就是linux里面的…

    参考:https://blog.csdn.net/qiushisoftware/article/details/79043379

    世界上所有的不公平都是由于当事人能力不足造成的.
  • 相关阅读:
    前端面试题目汇总摘录(HTML 和 CSS篇)
    The Road to learn React书籍学习笔记(第三章)
    The Road to learn React书籍学习笔记(第二章)
    算法复习:动态规划
    算法复习:回溯法
    算法复习:图
    算法复习:二叉树专题
    算法复习:最短路Dijkstra
    算法复习:BFS与DFS
    算法复习:标记数组 / 数组
  • 原文地址:https://www.cnblogs.com/javayida/p/13346923.html
Copyright © 2011-2022 走看看