Apache ZooKeeper

8 / 47
ZooKeeper - Introduction

== Intro == So what is Zookeeper? In very simple words, it is a central store of key-value using which distributed systems can coordinate. Since it needs to be able to handle the load, Zookeeper itself runs on many machines.

Zookeeper provides a simple set of primitives and it is very easy to program to. It uses a data model like directory tree.

It is used for synchronization, locking, maintaining configuration and failover management.

It does not suffer from Race Conditions and Dead Locks.

== Data Model ==

The way you store data in any store is called data model. In case of zookeeper, think of data model as if it is a highly available file system with little differences.

We store data in an entity called znode. The data that we store should be in JSON format which Java script object notation.

The znode can only be updated. It does not support append operations. The read or write is atomic operation meaning either it will be full or would throw an error if failed. There is no intermediate state like half written.

znode can have children. So, znodes inside znodes make a tree like heirarchy. The top level znode is "/".

The znode "/zoo" is child of "/" which top level znode. duck is child znode of zoo. It is denoted as /zoo/duck

Though "." or ".." are invalid characters as opposed to the file system.