Zookeeper-3.4.14 Cluster Construction

Keywords: Zookeeper

Zookeeper-3.4.14 Cluster Construction

Zookeeper-3.4.14 Installation

  • Official website download address:
    Zookeeper 3.4.14 Download
  • decompression
    tar -zxvf zookeeper-3.4.14.tar.gz
    
  • Modify configuration files
    cd /usr/local/software/zookeeper-3.4.14/conf/
    cp zoo_sample.cfg zoo.cfg
    vi zoo.cfg
    # Modify dataDir in zoo.cfg file 
        dataDir=/opt/data/zookeeper
    
  • Start zookeeper
    • Start the zookeeper server
        [root@node01 zookeeper-3.4.14]# bin/zkServer.sh start//start server
        ZooKeeper JMX enabled by default
        Using config: /usr/local/software/zookeeper-3.4.14/bin/../conf/zoo.cfg
        Starting zookeeper ... STARTED
        [root@node01 zookeeper-3.4.14]# jps  # View process
        7376 Jps
        7358 QuorumPeerMain
        [root@node01 zookeeper-3.4.14]# bin/zkServer.sh status # View state
        ZooKeeper JMX enabled by default
        Using config: /usr/local/software/zookeeper-3.4.14/bin/../conf/zoo.cfg
        Mode: standalone
      
    • Start the zookeeper client
      bin/zkCli.sh
      

Zookeeper 3.4.14 Cluster

  • Cluster Planning Noe01, Noe02, Noe03 Deployment Zookeeper
  • Modify configuration files
    • Modify the zoo.cfg file and append it at the end of the file
       server.1=node01:2888:3888
       server.2=node02:2888:3888
       server.3=node03:2888:3888
      
    • Add myid file
      The file content corresponds to zoo.cfg configuration. If node03 servers correspond to server.3, then myid content is 3
      root@node03 zookeeper]# cd /opt/data/zookeeper/
      [root@node03 zookeeper]# touch myid
      [root@node03 zookeeper]# vi myid
      [root@node03 zookeeper-3.4.14]# cat /opt/data/zookeeper/myid 
      3
      
  • Copy files to other servers
    scp -r /usr/local/software/zookeeper-3.4.14 root@node02:/usr/local/software/zookeeper-3.4.14
    scp -r /opt/data/zookeeper/ root@node02:/opt/data/zookeeper
    
  • Start Zookeeper on all servers
    [root@node01 zookeeper-3.4.14]# bin/zkServer.sh start
    ZooKeeper JMX enabled by default
    Using config: /usr/local/software/zookeeper-3.4.14/bin/../conf/zoo.cfg
    Starting zookeeper ... STARTED
    
  • inspect
    View Zookeeper status after all Zookeeper boots
    [root@node01 zookeeper-3.4.14]# bin/zkServer.sh status
    ZooKeeper JMX enabled by default
    Using config: /usr/local/software/zookeeper-3.4.14/bin/../conf/zoo.cfg
    Mode: follower
    

Posted by msgcrap on Wed, 10 Apr 2019 03:27:31 -0700