Zookeeper部署、指令

本文详细介绍如何在伪集群模式下安装与配置ZooKeeper。包括下载安装包、解压安装、配置三个不同实例的zoo.cfg文件以及创建必要的myid文件等内容。

安装包下载

http://www-us.apache.org/dist/zookeeper/zookeeper-3.3.6/

安装(伪集群模式)过程

  1. 解压:tar -zxvf zookeeper-3.4.5.tar.gz
  2. 配置文件:在conf目录下删除zoo_sample.cfg文件,创建一个配置文件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.
    dataDir=/home/jiangconglin/zk/data
    # the port at which the clients will connect
    clientPort=2187
    
    dataLogDir=/home/jiangconglin/zk/dataLog
    
    server.0=127.0.0.1:8880:3387    
    server.1=127.0.0.1:8881:3388    
    server.2=127.0.0.1:8882:3389 

  3. 配置文件:创建一个配置文件zoo1.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.
    dataDir=/home/jiangconglin/zk/data1
    # the port at which the clients will connect
    clientPort=2188
    
    dataLogDir=/home/jiangconglin/zk/dataLog1
    
    server.0=127.0.0.1:8880:3387    
    server.1=127.0.0.1:8881:3388    
    server.2=127.0.0.1:8882:3389


  4. 配置文件:创建一个配置文件zoo2.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.
    dataDir=/home/jiangconglin/zk/data2
    # the port at which the clients will connect
    clientPort=2189
    
    dataLogDir=/home/jiangconglin/zk/dataLog2
    
    server.0=127.0.0.1:8880:3387    
    server.1=127.0.0.1:8881:3388    
    server.2=127.0.0.1:8882:3389
  5. 创建myid
    在dataDir(/home/jiangconglin/zk/data|1|2)目录创建myid文件
    Server0机器的内容为:0
    Server1机器的内容为:1
    Server2机器的内容为:2
  6. 创建日志目录
    /home/jiangconglin/zk/dataLog
    /home/jiangconglin/zk/dataLog1
    /home/jiangconglin/zk/dataLog2

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值