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 Added

 

Get Source Code

Code Block
languagebash
git clone https://git.apache.org/zookeeper.git
svn checkout https://svn.apache.org/repos/asf/zookeeper/trunk/


Prepare for building

 JDK:


Code Block
languagebash
$java -version
openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-3ubuntu1~16.04.1-b14)



Software dependency:


Code Block
languagebash
sudo apt-get install doxygen
sudo apt-get install perl
sudo apt-get install shtool
sudo apt-get install graphviz
Ant:  Apache Ant(TM) version 1.9.6



Building Zookeeper on AArch64

 Modify the config file: build.xml


Code Block
languagexml
--- 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 

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

 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:


Code Block
languagebash
$ bin/zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /home/yuqi/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED



From JPS,  it is noted that zookeeper is running on AArch64 Server.
 

Code Block
languagebash
$ jps
20351 ZooKeeperMain