古道长亭

Contact me with ixiaoqiang0011@gmail.com


  • 首页

  • 归档

  • 分类

  • 关于

  • Book

  • 搜索

zookeeper环境搭建

时间: 2022-10-12   |   分类: zookeeper   | 字数: 377 字 | 阅读约: 1分钟 | 阅读次数:

zookeeper环境搭建

  • 单机模式

    不作演示

  • 伪集群模式

    在一台服务器上运行多个zookeeper,设置不同端口即可,与集群模式类似

  • 集群模式

    1. 下载 http://zookeeper.apache.org/releases.html

    2. 解压,比如解压到 /opt 目录下

    3. 在zookeeper目录下创建 data, logs目录

    4. 修改配置文件名 conf目录下 mv zoo_sample.cfg zoo.cfg

    5. 在每个data目录下创建一个myid文件,内容分别为1, 2, 3, …用于记录每个服务器的id

    6. 在每个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=/opt/zookeeper/data
      dataLogDir=/opt/zookeeper/logs
      # the port at which the clients will connect
      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
      
      ## Metrics Providers
      #
      # https://prometheus.io Metrics Exporter
      #metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
      #metricsProvider.httpPort=7000
      #metricsProvider.exportJvmInfo=true
      server.1=0.0.0.0:2888:3888 #当前服务器ip
      server.2=*.*.*.*:2888:3888 #其他服务咕咕Ip
      server.3=*.*.*.*:2888:3888
      
    7. 依次启动各个实例

#zookeeper#
QQ扫一扫交流

标题:zookeeper环境搭建

作者:古道长亭

声明: 欢迎加群交流!

如有帮助,欢迎多多交流 ^_^

微信打赏

支付宝打赏

Spring mvc 高级技术
Spring mvc 应用
  • 文章目录
  • 站点概览
古道长亭

古道长亭

Always remember that your present situation is not your final destination. The best is yet to come.

226 日志
57 分类
104 标签
GitHub Gitee
友情链接
  • 古道长亭的BOOK
  • JAVA学习
标签云
  • Mysql
  • 搜索引擎
  • Mybatis
  • 容器
  • 架构
  • 消息队列
  • Flink
  • Sharding sphere
  • 流处理
  • 缓存
© 2019 - 2024 京ICP备19012088号-1
0%