zoukankan      html  css  js  c++  java
  • centos7 下zookeeper 部署 单机多实例模式

      centos7 下zookeeper 部署

        本文参考https://www.linuxidc.com/Linux/2016-09/135052.htm

      1.创建/usr/local/zookeeper文件夹

        mkdir /usr/local/zookeeper

      2.进入/usr/local/zookeeper文件夹

        cd /usr/local/zookeeper

      3.下载zookeeper

        wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.9/zookeeper-3.4.9.tar.gz 也可以自己下载到本地,然后上传到服务器

      4.解压zookeeper

        tar -zxvf zookeeper-3.4.9.tar.gz

      5.进入到 /usr/local/zookeeper/zookeeper-3.4.9/conf 目录中

        cd zookeeper-3.4.9/conf/

      6.复制 zoo_sample.cfg 文件的并命名为为 zoo.cfg:

        cp zoo_sample.cfg zoo.cfg

      7.用 vim 打开 zoo.cfg 文件并修改其内容为如下

        vim zoo.cfg

        # The number of milliseconds of each tick
     
           # zookeeper 定义的基准时间间隔,单位:毫秒
           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/zookeeper/zookeeper-3.4.9/data/data1

         # 数据文件夹
          dataDir=/usr/local/zookeeper/zookeeper-3.4.9/data/data1
     
          # 日志文件夹
          dataLogDir=/usr/local/zookeeper/zookeeper-3.4.9/logs/log1
     
          # the port at which the clients will connect
          # 客户端访问 zookeeper 的端口号
          clientPort=2181
     
          # 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

       8.保存并关闭 zoo.cfg 文件:

          按esc后,:wq   回车

       9.进入到 根目录中

        cd

       10.用 vim 打开 /etc/ 目录下的配置文件 profile

         vim /etc/profile

        加入:

         export ZOOKEEPER_HOME=/usr/local/services/zookeeper/zookeeper-3.4.9/
            export PATH=$ZOOKEEPER_HOME/bin:$PATH
            export PATH 

       11.使 /etc/ 目录下的 profile 文件即可生效

          source  /etc/profile

       12.启动 zookeeper 服务

          zkServer.sh start      (不指定配置文件的话默认为conf/zoo.cfg)

          如打印如下信息则表明启动成功:
              ZooKeeper JMX enabled by default
              Using config: /usr/local/zookeeper/zookeeper-3.4.9/bin/../conf/zoo.cfg
              Starting zookeeper ... STARTED

        13.常用的命令:

          查询 zookeeper 状态      zkServer.sh status

           关闭 zookeeper 服务    zkServer.sh stop

          重启zookeeper 服务    zkServer.sh  restart

        

    配置单机多实例,需要复制一份zoo.cfg文件修改clientPort的端口号,修改dataDir 和 dataLogDir的路径,然后启动zookeeper,启动命令需要指定配置文件

        zkServer.sh start  ../conf/zooother.cfg

      

        

  • 相关阅读:
    asmxwebservicebasicauthentication
    asp.net mvc uploading_and_returning_files
    HTTP请求格式 状态码404,404等
    HTTP BASIC 应用(2)
    [转载]HTML生成PDF(c#)
    [转载]ASP.NET MVC的例子中都使用了Repository模式
    spring MVC 如何接收前台传入的JSON对象数组并处理
    表格中的checkbox复选框 全选非全选 公共方法 及提交选中结果
    atitit.提升开发效率MDA 软件开发方式的革命(5)列表查询建模
    atitit.提升开发效率MDA 软件开发方式的革命(3)自动化建表
  • 原文地址:https://www.cnblogs.com/dakewang/p/9408326.html
Copyright © 2011-2022 走看看