• zookeeper集群安装


    zookeeper集群安装

    1. 从镜像下载zookeeper的地址 , 这个镜像可以自行选择,笔者选择的是稳定版(stable)

      wget https://mirrors.cnnic.cn/apache/zookeeper/stable/apache-zookeeper-3.6.3-bin.tar.gz
      
      • 1
    2. 创建log,data目录在zookeeper目录下面,与bin目录平级

      [root@iZuf64fa3s2az73p556he0Z apache-zookeeper-3.6.3]# ll
       total 192
       drwxr-xr-x  2 1000 1000  4096 Nov  3 14:03 bin
       -rw-r--r--  1 1000 1000  2692 Apr  9  2021 checkstyle-simple.xml
       -rw-r--r--  1 1000 1000 17804 Apr  9  2021 checkstyle-strict.xml
       -rw-r--r--  1 1000 1000  1538 Apr  9  2021 checkstyleSuppressions.xml
       drwxr-xr-x  2 1000 1000  4096 Nov  3 14:41 conf
       drwxr-xr-x  5 root root  4096 Nov  3 14:26 data
       drwxr-xr-x  3 1000 1000  4096 Apr  9  2021 dev
       -rw-r--r--  1 1000 1000   347 Apr  9  2021 excludeFindBugsFilter.xml
       -rw-r--r--  1 1000 1000  2649 Apr  9  2021 Jenkinsfile
       -rw-r--r--  1 1000 1000  1776 Apr  9  2021 Jenkinsfile-owasp
       -rw-r--r--  1 1000 1000  1892 Apr  9  2021 Jenkinsfile-PreCommit
       -rw-r--r--  1 1000 1000 11358 Apr  9  2021 LICENSE.txt
       drwxr-xr-x  5 root root  4096 Nov  3 14:43 log
       -rw-r--r--  1 1000 1000   432 Apr  9  2021 NOTICE.txt
       -rw-r--r--  1 1000 1000  2019 Apr  9  2021 owaspSuppressions.xml
       -rwxr-xr-x  1 1000 1000 35189 Apr  9  2021 pom.xml
       -rw-r--r--  1 1000 1000  1963 Apr  9  2021 README.md
       -rw-r--r--  1 1000 1000  3166 Apr  9  2021 README_packaging.md
       -rw-r--r--  1 1000 1000 21474 Apr  9  2021 zk-merge-pr.py
       drwxr-xr-x  3 1000 1000  4096 Nov  3 14:03 zookeeper-assembly
       drwxr-xr-x  3 1000 1000  4096 Nov  3 14:03 zookeeper-client
       drwxr-xr-x  3 1000 1000  4096 Nov  3 14:03 zookeeper-compatibility-tests
       drwxr-xr-x 12 1000 1000  4096 Nov  3 14:03 zookeeper-contrib
       drwxr-xr-x  3 1000 1000  4096 Nov  3 14:03 zookeeper-docs
       drwxr-xr-x  3 1000 1000  4096 Nov  3 14:03 zookeeper-it
       drwxr-xr-x  3 1000 1000  4096 Nov  3 14:03 zookeeper-jute
       drwxr-xr-x  3 1000 1000  4096 Nov  3 14:03 zookeeper-metrics-providers
       drwxr-xr-x  5 1000 1000  4096 Nov  3 14:03 zookeeper-recipes
       drwxr-xr-x  3 1000 1000  4096 Nov  3 14:03 zookeeper-server
      
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      • 7
      • 8
      • 9
      • 10
      • 11
      • 12
      • 13
      • 14
      • 15
      • 16
      • 17
      • 18
      • 19
      • 20
      • 21
      • 22
      • 23
      • 24
      • 25
      • 26
      • 27
      • 28
      • 29
      • 30
      • 31
    3. 创建data/zoo/myid文件,里面信息为zookeeper的编号,

      [root@iZuf64fa3s2az73p556he0Z apache-zookeeper-3.6.3]# cd data
      [root@iZuf64fa3s2az73p556he0Z data]# ls
      zoo  zoo-2  zoo-3
      [root@iZuf64fa3s2az73p556he0Z data]# cd zoo
      [root@iZuf64fa3s2az73p556he0Z zoo]# ls
      myid
      [root@iZuf64fa3s2az73p556he0Z zoo]# cat myid 
      1
      [root@iZuf64fa3s2az73p556he0Z zoo]# 
      
      
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      • 7
      • 8
      • 9
      • 10
    4. 创建zoo目录在log目录下面

      [root@iZuf64fa3s2az73p556he0Z apache-zookeeper-3.6.3]# cd log/
      [root@iZuf64fa3s2az73p556he0Z log]# ls
      zoo  zoo-2  zoo-3
      [root@iZuf64fa3s2az73p556he0Z log]# cd zoo
      [root@iZuf64fa3s2az73p556he0Z zoo]# pwd
      /usr/local/software/apache-zookeeper-3.6.3/log/zoo
      [root@iZuf64fa3s2az73p556he0Z zoo]# 
      
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      • 7
    5. 创建conf文件,在conf目录,文件名zoo.cfg,修改datadir和datalogdir路径

      # 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=/usr/local/apache-zookeeper-3.6.3/data/zoo
      dataLogDir=/usr/local/apache-zookeeper-3.6.3/log/zoo
      # the port at which the clients will connect
      clientPort=2181
      #nodelist
      server.1=zoo1:2888:3888
      server.2=zoo2:2888:3888
      server.3=zoo3:2888:3888
      
      # 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
      
      ## Metrics Providers
      #
      # https://prometheus.io Metrics Exporter
      #metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
      #metricsProvider.httpPort=7000
      #metricsProvider.exportJvmInfo=true
      
      
      
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      • 7
      • 8
      • 9
      • 10
      • 11
      • 12
      • 13
      • 14
      • 15
      • 16
      • 17
      • 18
      • 19
      • 20
      • 21
      • 22
      • 23
      • 24
      • 25
      • 26
      • 27
      • 28
      • 29
      • 30
      • 31
      • 32
      • 33
      • 34
      • 35
      • 36
      • 37
      • 38
      • 39
      • 40
      • 41
      • 42
      • 43
    6. 笔者集群ip

      139.196.72.48 zoo1
      47.102.128.87 zoo2
      114.55.103.145 zoo3
      
      • 1
      • 2
      • 3

    7 笔者启动之后报错了,

    在logs目录下面看到具体的报错信息如下
    翻找资料说是ip的端口

    ## 在zoo.cfg配置中添加
    quorumListenOnAllIPs=true
    
    • 1
    • 2
  • 相关阅读:
    SpringBoot整合Redis
    计算机组成与体系结构-进制转换
    6.前端·新建子模块与开发(常规开发)
    【JavaScript】用字符串生成 DOM 元素
    python-文件和异常
    Java进阶(一)面向对象进阶简介
    新建WPF项目
    java常量和变量
    Matplotlib实现Label及Title都在下方的最佳姿势
    标本传送设备物联网应用案例|蓝蜂物联网一体化方案
  • 原文地址:https://blog.csdn.net/yitian881112/article/details/127681654