zoukankan      html  css  js  c++  java
  • centos7 安装zookeeper3.4.8集群

    1.下载上传文件到centos中

    2.解压文件夹

    3.cd conf 文件下,cp  zoo_sample.cfg  zoo.cfg

    4.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=/opt/zookeeper
    # 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
    server.1=192.168.121.131:2888:3888
    server.2=192.168.121.129:2888:3888

    设置文件如上所示:

    ip地址也可以用主机名代替

    5.创建myid文件,在/opt/zookeeper 文件夹下 创建myid  运行命令  touch myid   ,   然后写入数字   echo 1 >myid

    6.在192.168.121.129 中也如192.168.121.131相关的操作

    7.关掉防火墙,或者打开相应的端口

    8.cd 到  bin 目录下

    9.启动server.1 然后启动 server.2 ,./zkServer.sh start

    10.过一段时间运行./zkServer.sh status  查看状态如果显示下面的信息则表示成功

    [root@fymold bin]# ./zkServer.sh status
    ZooKeeper JMX enabled by default
    Using config: /home/fuyuanming/zookeeper-3.4.8/bin/../conf/zoo.cfg
    Mode: leader

    或者:

    [root@fymnew bin]# ./zkServer.sh status
    ZooKeeper JMX enabled by default
    Using config: /home/fuyuanming/zookeeper-3.4.8/bin/../conf/zoo.cfg
    Mode: follower

    表示成功

  • 相关阅读:
    Windows下使用Nginx+tomcat配置负载均衡
    Windows系统搭建Mysql Cluster集群
    java.math.BigDecimal cannot be cast to java.lang.String解决方法
    Java从后台重定向(redirect)到另一个项目的方法
    Java代码中获取配置文件(config.properties)中内容的两种方法
    mybatis和redis整合 log4j打印sql语句
    Windows系统安装测试redis
    myeclipse 2014新建maven web 项目步骤
    myeclipse用maven搭建web项目后tomcat启动报找不到jar包解决办法
    《剑指offer》丑数
  • 原文地址:https://www.cnblogs.com/fuyuanming/p/6928074.html
Copyright © 2011-2022 走看看