Installation and deployment of ZooKeeper

Two Zookeeper installation deployment

2.1 Zookeeper installation

  • Zookeeper before installation need to install JDK. Configuring environment variables.

  • Download: ZooKeeper-3.4.5-cdh5.7.0.tar.gz

  • Decompression

    tar -zxvf zookeeper-3.4.5-cdh5.7.0.tar.gz  -C ~/app/
  • Unzip into the zookeeper directory to find the conf directory and copy the configuration file and edit

    cp zoo_sample.cfg zoo.cfg 
    vi zoo.cfg
  • Add the following in the zoo.cfg

    dataDir=/home/hadoop/app/zookeeper-3.4.5-cdh5.7.0/data
    dataLogDir=/home/hadoop/app/zookeeper-3.4.5-cdh5.7.0/logs
  • Once configured, go to the bin directory run

    ./zkServer.sh start
  • View the running status

    ./zkServer.sh status 
    
    JMX enabled by default
    Using config: /home/hadoop/app/zookeeper-3.4.5-cdh5.7.0/bin/../conf/zoo.cfg
    Mode: standalone
  • Stop running

    ./zkServer.sh stop
    
    Using config: /home/hadoop/app/zookeeper-3.4.5-cdh5.7.0/bin/../conf/zoo.cfg
    Stopping zookeeper ... STOPPED

2.2 zoo.cfg Configuration

  • tickTime: time unit for calculating a session timeout, such as: N * tickTime
  • initLimit: a cluster, and allow connections from the node to the master node synchronizing connection initialization time, expressed in multiples tickTime
  • syncLimit: a cluster, the master node and the Master to send messages between nodes, the request and response time length (heartbeat mechanism).
  • dataDir: You must configure
  • dataLogDir: log directory, if you do not configure the public will and dataDir
  • clientPort: port connection to the server, the default 2181

2.3 Zookeeper main directory structure

  • bin Some of the major operational command
  • conf store configuration files, which need to be amended is zk.cfg
  • contrib: Some additional features
  • dist-maven: after mvn compile directory
  • docs: Documentation
  • lib: need to rely on the jar package
  • recipes: Case demo code
  • src: Source

Guess you like

Origin www.cnblogs.com/xinyonghu/p/11031919.html