zookeeper 2.4.6安装

准备工作

  • zookeeper安装包zookeeper-3.4.6.tar.gz
  • s0,s1,s2 三台服务器配置zookeeper环境
  • 先在s0配置好,在把配置文件夹同步 $ZOOKEEPER_HOME/conf
  • 每台机器要单独启动,关闭

操作步骤

  • 解压压缩包

    tar -zxvf /opt/modules/bigdata/zookeeper/zookeeper-3.4.6.tar.gz -C /opt/modules/bigdata/zookeeper 即 $ZOOKEEPER_HOME=/opt/modules/bigdata/zookeeper/zookeeper-3.4.6

  • 复制文件 $ZOOKEEPER_HOME/conf/zoo_sample.cfg 为 $ZOOKEEPER_HOME/conf/zoo.cfg 增加内容

      dataDir=/opt/modules/bigdata/zookeeper/zookeeper-3.4.6/data
      dataLogDir=/opt/modules/bigdata/zookeeper/zookeeper-3.4.6/logs
      server.0=s0:2888:3888
      server.1=s1:2888:3888
      server.2=s2:2888:3888
    
  • 新建目录logs ==> $ZOOKEEPER_HOME/logs
  • 新建目录data ==> $ZOOKEEPER_HOME/data
  • 增加文件myid ==> $ZOOKEEPER_HOME/data/myid

    myid s0内容为:
    0
    myid s1内容为:
    1
    myid s2内容为:
    2
    

    命令

  • 需要分别启动,停止每一台机器
  • ).启动 zookeeper: /opt/modules/bigdata/zookeeper/zookeeper-3.4.6/bin/zkServer.sh start
  • ).停止 zookeeper: /opt/modules/bigdata/zookeeper/zookeeper-3.4.6/bin/zkServer.sh stop
  • ).状态 zookeeper: /opt/modules/bigdata/zookeeper/zookeeper-3.4.6/bin/zkServer.sh status

jps 验证

s0,s1,s2 每台机器都有进程:QuorumPeerMain