How to install Zookeeper service on Linux system

How to install Zookeeper service on Linux system

1. Create the /usr/local/services/zookeeper folder:

  mkdir -p /usr/local/services/zookeeper

2. Enter the /usr/local/services/zookeeper directory:

  cd /usr/local/services/zookeeper

3. Download zookeeper-3.4.9.tar.gz:

 wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.9/zookeeper-3.4.9.tar.gz

4. Unzip zookeeper-3.4.9.tar.gz:

  tar -zxvf zookeeper-3.4.9.tar.gz

5. Enter the /usr/local/services/zookeeper/zookeeper-3.4.9/conf directory:

cd zookeeper-3.4.9/conf/

6. Copy the zoo_sample.cfg file and name it zoo.cfg:

cp zoo_sample.cfg zoo.cfg

7. Use vim to open the zoo.cfg file and modify its content as follows:

# The number of milliseconds of each tick
    # The benchmark time interval defined by zookeeper, unit: milliseconds 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=/tmp/zookeeper
   #Data folder dataDir=/usr/local/services/zookeeper/zookeeper-3.4.9/data
   # Log folder dataLogDir=/usr/local/services/zookeeper/zookeeper-3.4.9/logs
   # the port at which the clients will connect
   # The port number for the client to access zookeeper is 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

8. Save and close the zoo.cfg file:

9. Enter the /usr/local/services/zookeeper/zookeeper-3.4.9/bin directory:

cd ../bin/

10. Use vim to open the profile configuration file in the /etc/ directory:

vim /etc/profile

And append the following content at the end:

 # idea - zookeeper-3.4.9 config start - 2016-09-08
   export ZOOKEEPER_HOME=/usr/local/services/zookeeper/zookeeper-3.4.9/
   export PATH=$ZOOKEEPER_HOME/bin:$PATH
   export PATH
   # idea - zookeeper-3.4.9 config start - 2016-09-08

11. Make the profile file in the /etc/ directory effective:

 source /etc/profile

12. Start the zookeeper service:

zkServer.sh start

If the following information is printed, it indicates that the startup is successful:

  ZooKeeper JMX enabled by default
   Using config: /usr/local/services/zookeeper/zookeeper-3.4.9/bin/../conf/zoo.cfg
   Starting zookeeper ... STARTED

13. Query the zookeeper status:

  zkServer.sh status

14. Shut down the zookeeper service:

 zkServer.sh stop

If the following information is printed, it indicates successful closure:

 ZooKeeper JMX enabled by default
   Using config: /usr/local/services/zookeeper/zookeeper-3.4.9/bin/../conf/zoo.cfg
   Stopping zookeeper ... STOPPED

15. Restart the zookeeper service:

zkServer.sh restart

If the following information is printed, it indicates that the restart is successful:

  ZooKeeper JMX enabled by default
   Using config: /usr/local/services/zookeeper/zookeeper-3.4.9/bin/../conf/zoo.cfg
   ZooKeeper JMX enabled by default
   Using config: /usr/local/services/zookeeper/zookeeper-3.4.9/bin/../conf/zoo.cfg
   Stopping zookeeper ... STOPPED
   ZooKeeper JMX enabled by default
   Using config: /usr/local/services/zookeeper/zookeeper-3.4.9/bin/../conf/zoo.cfg
   Starting zookeeper ... STARTED

Summarize

The above is the introduction of installing Zookeeper service in Linux. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • Zookeeper connection timeout problem and solution to connection rejection
  • Which is better, Zookeeper or Eureka?
  • Zookeeper Overview Detailed Illustrations
  • Detailed explanation of zookeeper node types
  • Detailed explanation of the principle of zookeeper listener
  • How to extract the zookeeper address from the dubbo zookeeper registration address
  • Tutorial on installing Zookeeper on Linux and starting and shutting down
  • Detailed explanation of how to build services using dubbo+zookeeper+spring boot
  • How to use Zookeeper to build a configuration center in SpringCloud
  • Some suggestions for optimizing zookeeper service

<<:  MySQL InnoDB monitoring (system layer, database layer)

>>:  JavaScript to achieve a simple page countdown

Recommend

How to configure mysql5.6 to support IPV6 connection in Linux environment

Introduction: This article mainly introduces how ...

Detailed explanation of pipeline and valve in tomcat pipeline mode

Preface In a relatively complex large system, if ...

Methods for defragmenting and reclaiming space in MySQL tables

Table of contents Causes of MySQL Table Fragmenta...

Implementation of new issues of CSS3 selectors

Table of contents Basic Selector Extensions Attri...

Graphic tutorial on installing Mac system in virtual machine under win10

1. Download the virtual machine version 15.5.1 I ...

TimePicker in element disables part of the time (disabled to minutes)

The project requirements are: select date and tim...

How to use Navicat to operate MySQL

Table of contents Preface: 1. Introduction to Nav...

Vue.js implements music player

This article shares the specific code of Vue.js t...

MySQL's method of dealing with duplicate data (preventing and deleting)

Some MySQL tables may contain duplicate records. ...

Native JS implements a very good-looking counter

Today I will share with you a good-looking counte...

How to set background blur with CSS

When making some pages, in order to make the page...

Detailed tutorial on installing mysql 5.7.26 on centOS7.4

MariaDB is installed by default in CentOS, which ...