ZooKeeper Distributed Actual Warfare - Basic Installation Configuration

Keywords: Big Data Zookeeper Java REST

1 Overview

1.1 Introduction to Zookeeper

  • Middleware, providing coordination services
  • Acting on the distributed system and giving full play to its advantages, it can serve the big data
  • Support Java, provide Java and C language client API

1.2 what is distributed system?

  • Many computers form a whole, one whole is consistent with the outside world and processes the same request.
  • Every computer inside can communicate with each other (REST/RPC)
  • A client-to-server request goes through multiple computers until the end of the response

1.3 Distributed System Bottleneck

Characteristics of 1.3.1 zookeeper

  • Uniformity Data consistency, data in batches in order
  • Atomicity Transactions either succeed or fail, not localized
  • Single view The client connects to any zk node in the cluster, and the data is consistent
  • reliability The state of each zk operation is saved on the server side
  • Real time Client can read the latest data of zk server

2 Download, Installation and Configuration

Install JDK

2.1 Single Computer Mode

2.1.1 Linux environment operation

2.1.2 Mac OS Operation

$brew install zookeeper
==> Downloading https://homebrew.bintray.com/bottles/zookeeper-3.4.6_1.mavericks.bottle.2.tar.gz
######################################################################## 100.0%
==> Pouring zookeeper-3.4.6_1.mavericks.bottle.2.tar.gz
==> Caveats
To have launchd start zookeeper at login:
  ln -sfv /usr/local/opt/zookeeper/*.plist ~/Library/LaunchAgents
Then to load zookeeper now:
  launchctl load ~/Library/LaunchAgents/homebrew.mxcl.zookeeper.plist
Or, if you don't want/need launchctl, you can just run:
  zkServer start
==> Summary

  • After installation, there are default configuration files in the / usr/local/etc/zookeeper / directory

  • Configure [/usr/local/etc/zookeeper/zoo.cfg] file

# 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.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/usr/local/var/run/zookeeper/data
# the port at which the clients will connect
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
  • There are many executable files under bin

Common commands

3.1 boot

  • Execute the command zkServer

  • zkServer status

  • zkServer start

3.2 View Running Status

Posted by Magwheel on Mon, 07 Oct 2019 20:28:50 -0700