ZooKeeper is shipped with an official C client library, which can be used to develop distributed applications in C/C++. Many of the other language bindings such as the Python client binding shipped with ZooKeeper distribution are built using the C library. In this section, we will learn about the C client APIs and illustrate their usage by developing a znode data-watcher client.
In the Connecting to ZooKeeper with C-based shell section of Chapter 1, A Crash Course in Apache ZooKeeper, we learned how to build the ZooKeeper C library and the C-based shell using the
make command. Once we build the C library, the following two shared libraries get built:
The multi-threaded library:
The single-thread library:
The libraries are usually installed in
/usr/local/lib. You need to have this path exported through your
LD_LIBRARY_PATH environment variables for the applications to find the libraries.
The multi-threaded library is most commonly...