Zookeeper部署、指令

来源:互联网 发布:重庆大学出版社淘宝网 编辑:程序博客网 时间:2024/05/20 04:51

安装包下载

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 ticktickTime=2000# The number of ticks that the initial # synchronization phase can takeinitLimit=10# The number of ticks that can pass between # sending a request and getting an acknowledgementsyncLimit=5# the directory where the snapshot is stored.dataDir=/home/jiangconglin/zk/data# the port at which the clients will connectclientPort=2187dataLogDir=/home/jiangconglin/zk/dataLogserver.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 ticktickTime=2000# The number of ticks that the initial # synchronization phase can takeinitLimit=10# The number of ticks that can pass between # sending a request and getting an acknowledgementsyncLimit=5# the directory where the snapshot is stored.dataDir=/home/jiangconglin/zk/data1# the port at which the clients will connectclientPort=2188dataLogDir=/home/jiangconglin/zk/dataLog1server.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 ticktickTime=2000# The number of ticks that the initial # synchronization phase can takeinitLimit=10# The number of ticks that can pass between # sending a request and getting an acknowledgementsyncLimit=5# the directory where the snapshot is stored.dataDir=/home/jiangconglin/zk/data2# the port at which the clients will connectclientPort=2189dataLogDir=/home/jiangconglin/zk/dataLog2server.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

原创粉丝点击