zoukankan      html  css  js  c++  java
  • 安装部署zookeeper集群

    实验说明:  三台虚拟机做zookeeper集群,集群个数最好是奇数个,原理详见zookeeper 详解

           安装zookeeper 请确保jdk 已安装好,否则无法启动

           三台虚拟机IP分别为:192.168.12.162  192.168.12.163  192.168.12.164

    一、 ssh 登陆192.168.12.162 做如下操作:

     

    1.1 下载解压zookeeper

    1 wget http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz -P /opt
    2 tar xf /opt/zookeeper-3.4.6.tar.gz -C /usr/local/
    3 mv /usr/local/zookeeper-3.4.6 /usr/local/zookeeper
    4 mkdir -p /usr/local/zookeeper/zookeeper-data/logs
    5 echo1”> /usr/local/zookeeper/zookeeper-data/myid
    6 mv /usr/local/zookeeper/conf/zoo_sample.cfg /usr/local/zookeeper/conf/zoo.cfg

    1.2 配置zookeeper集群

    vim /usr/local/zookeeper/conf/zoo.cfg

    tickTime=2000
    initLimit=10
    syncLimit=5
    dataDir=/usr/local/zookeeper/zookeeper-data
    dataLogDir=/usr/local/zookeeper/zookeeper-data/logs
    clientPort=2181
    server.1=192.168.12.162:2888:3888
    server.2=192.168.12.163:2888:3888
    server.3=192.168.12.164:2888:3888

    1.3 修改默认zookeeper.out 日志输出位置:

     

    将原日志输出文件位置注释掉,然后新增一行:

    ZOO_LOG_DIR="/usr/local/zookeeper/zookeeper-data/logs"

    编辑如下文件修改成如下样式:  

    vim /usr/local/zookeeper/bin/zkEnv.sh

    1.4 同步集群中其他服务器配置

    1 scp –r /usr/local/zookeeper root@192.168.12.163:/usr/local/
    2 scp –r /usr/local/zookeeper root@192.168.12.164:/usr/local/

    二、 ssh 登陆192.168.12.163 修改myid 文件:

    echo “2” > /usr/local/zookeeper/zookeeper-data/myid

    三、ssh 登陆192.168.12.164修改myid 文件:

    echo “3” > /usr/local/zookeeper/zookeeper-data/myid

     

    四、 分别在三台机器上执行如下操作:

    4.1 启动zookeeper服务

    /usr/local/zookeeper/bin/zkServer.sh start

    4.2 查看zookeeper 启动状态

    /usr/local/zookeeper/bin/zkServer.sh status

    4.2 如启动失败,重新启动zookeeper 置于前台运行,可看到报错信息

    /usr/local/zookeeper/bin/zkServer.sh start-foreground

      

     

     

     

  • 相关阅读:
    chrome远程调试真机上的app
    高性能Cordova App开发学习笔记
    eclipse导入cordova项目
    跨域后模拟器上还是不能显示数据
    跨域请求数据
    eclipse导入cordova创建的项目
    cordova添加platform
    sdk更新代理设置
    NPM安装之后CMD中不能使用
    android开发环境搭建
  • 原文地址:https://www.cnblogs.com/cpy-devops/p/7074526.html
Copyright © 2011-2022 走看看