Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

ZooKeeper is a distributed, open-source coordination service for distributed applications. It exposes a simple set of primitives that distributed applications can build upon to implement higher level services for synchronization, configuration maintenance, and groups and naming. It is designed to be easy to program to, and uses a data model styled after the familiar directory tree structure of file systems. It runs in Java and has bindings for both Java and C.

ZooKeeper Service

Image Modified

 

Get Source Code

git clone https://git.apache.org/zookeeper.git

...

Apache Ant(TM) version 1.9.6

Build Zookeeper

 modify the build.xml

 

 

...

Building Zookeeper

 build.xml

--- a/build.xml

+++ b/build.xml @@ -40,8 +40,8 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">     

<property name="revision.properties" value="revision.properties" />     

<property file="${basedir}/src/java/${revision.properties}" />

-    <property name="javac.target" value="1.7" />

-    <property name="javac.source" value="1.7" />

+    <property name="javac.target" value="1.8" />

+    <property name="javac.source" value="1.8" />     

<property name="build.encoding" value="utf8" />

 

 Building & UT using ant

$ ant

$ ant -Djavac.args="-Xlint -Xmaxwarns 1000 " clean test tar

 ja

 Configuration 

 To start ZooKeeper we need a configuration file. Here is a sample, create it in conf/zoo.cfg:

tickTime=2000

dataDir=/var/lib/zookeeper

clientPort=2181

tickTime

 the basic time unit in milliseconds used by ZooKeeper. It is used to do heartbeats and the minimum session timeout will be twice the tickTime.

dataDir

the location to store the in-memory database snapshots and, unless specified otherwise, the transaction log of updates to the database.

clientPort

 the port to listen for client connections

Start ZooKeeper

$ bin/zkServer.sh start

ZooKeeper JMX enabled by default
Using config: /home/yuqi/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

 

From JPS, zookeeper is running on AArch64 Server :

$ jps

20351 ZooKeeperMain