zoukankan      html  css  js  c++  java
  • CentOS下安装zookeeper

    Linux下安装Zookeeper集群步骤

    (1) 下载zookeeper安装包

      地址:http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz

    (2) 解压安装包并放置在对应的路径下

      解压对应文件到对应的路径下,本文将zookeeper解压到/soft/zk路径下,并在zk路径下建立 dataDir与dataLogDir路径

      cd /soft/zk

      tar -xvf zookeeper-xxx.tar.gz

      mkdir dataDir

      mkdir dataLogDir

    (3) 配置zookeeper的配置文件

      对zookeeper进行配置

      cd /soft/zk/zookeeper-xxx/conf

      cp zoo-sample.cfg zoo.cfg

      vim 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=/soft/zk/dataDir dataLogDir=/soft/zk/dataLogDir # the port at which the clients will connect clientPort=2181 server.1=192.168.1.111:2888:3888 server.2=192.168.1.112:2888:3888 server.3=192.168.1.113:2888:3888

    这里对zookeeper服务器进行配置,这里需要将myid与对应的服务器编号对应

    (4) 设置zookeeper对应的myid文件

      cd /soft/zk/dataDir

      vim myid

      将服务器编号放入

    (5) 启动zookeeper服务

      cd /soft/zk/zookeeper-xxx/bin

      sh zkServer.sh start

      启动服务,注意查看zookeeper.out这个日志输出,可以看到问题点

    (6) 验证zookeeper是否正常启动

      cd /soft/zk/zookeeper-xxx/bin

      sh zkServer.sh status

      sh zkCli.sh -server 192.168.1.111:2181

    (7) 查询zookeeper服务器对应的主从关系状态

      cd /soft/zk/zookeeper-xxx/bin

      sh zkServer.sh status

    (8) 注意点,如果客户端与服务器的时间相差比较大,客户端退出后,创建的临时节点不会自动删除。

  • 相关阅读:
    (二)全局属性
    (十二)this关键字
    (十一)构造方法的重载和成员方法的重载
    (十)foreac遍历、break和countinue以及标签和switch循环
    java集合
    关于java赋值操作的原子性问题
    spring list map set
    apache benchmark
    为什么java web项目中要使用spring
    spring IOC
  • 原文地址:https://www.cnblogs.com/rainy-shurun/p/5161950.html
Copyright © 2011-2022 走看看