Kezhu Wang b86ccf19cf ZOOKEEPER-3766: [ADDENDUM] Fix TestSASLAuth failure 1 month ago
..
include 7316c495af ZOOKEEPER-4895: Support encrypted password file during SASL authentication for C client 1 month ago
src 7316c495af ZOOKEEPER-4895: Support encrypted password file during SASL authentication for C client 1 month ago
ssl 69d95a256d ZOOKEEPER-3766: Clean up bash scripts 1 month ago
tests b86ccf19cf ZOOKEEPER-3766: [ADDENDUM] Fix TestSASLAuth failure 1 month ago
CMakeLists.txt 7316c495af ZOOKEEPER-4895: Support encrypted password file during SASL authentication for C client 1 month ago
ChangeLog 9a2dc253ca ZOOKEEPER-4834. fix typos in Apache ZooKeeper (#2167) 9 months ago
INSTALL 176bd68222 ZOOKEEPER-3031: MAVEN MIGRATION - Step 1.4 - move client dir 6 years ago
LICENSE 9a2dc253ca ZOOKEEPER-4834. fix typos in Apache ZooKeeper (#2167) 9 months ago
Makefile.am 64863119bf ZOOKEEPER-3654: Incorrect *_CFLAGS handling in Automake 5 years ago
NOTICE.txt 176bd68222 ZOOKEEPER-3031: MAVEN MIGRATION - Step 1.4 - move client dir 6 years ago
README 4f35790b30 ZOOKEEPER-4782: The installation guide in zookeeper-client/zookeeper-… 1 year ago
acinclude.m4 9a2dc253ca ZOOKEEPER-4834. fix typos in Apache ZooKeeper (#2167) 9 months ago
aminclude.am 176bd68222 ZOOKEEPER-3031: MAVEN MIGRATION - Step 1.4 - move client dir 6 years ago
c-doc.Doxyfile 176bd68222 ZOOKEEPER-3031: MAVEN MIGRATION - Step 1.4 - move client dir 6 years ago
cmake_config.h.in 176bd68222 ZOOKEEPER-3031: MAVEN MIGRATION - Step 1.4 - move client dir 6 years ago
configure.ac b02497fd3b [maven-release-plugin] prepare for next development iteration 1 year ago
pom.xml 499d1b031f ZOOKEEPER-4826 Reduce unnecessary executable permissions on files (#2157) 1 year ago

README

Zookeeper C client library


This package provides a C client interface to Zookeeper server.

For the latest information about ZooKeeper, please visit our website at:
http://zookeeper.apache.org/
and our wiki, at:
https://cwiki.apache.org/confluence/display/ZOOKEEPER

Full documentation for this release can also be found in ../../docs/index.html


OVERVIEW

The client supports two types of APIs -- synchronous and asynchronous.

Asynchronous API provides non-blocking operations with completion callbacks and
relies on the application to implement event multiplexing on its behalf.

On the other hand, Synchronous API provides a blocking flavor of
zookeeper operations and runs its own event loop in a separate thread.

Sync and Async APIs can be mixed and matched within the same application.

The package includes two shared libraries: zookeeper_st and
zookeeper_mt. The former only provides the Async API and is not
thread-safe. The only reason this library exists is to support the
platforms were pthread library is not available or unstable
(i.e. FreeBSD 4.x). In all other cases the application developers are
advised to link against zookeeper_mt as it includes support for both
Sync and Async API.


INSTALLATION

Please refer to the "Installation" item under "C Binding" section in file
".../trunk/zookeeper-docs/src/main/resources/markdown/zookeeperProgrammers.md"

EXAMPLE/SAMPLE C CLIENT SHELL

NOTE: the ZooKeeper C client shell (cli_st and cli_mt) is meant as a
example/sample of ZooKeeper C client API usage. It is not a full
fledged client and not meant for production usage - see the Java
client shell for a fully featured shell.

You can test your client by running a zookeeper server (see
instructions on the project wiki page on how to run it) and connecting
to it using the zookeeper shell application cli that is built as part
of the installation procedure.

cli_mt (multithreaded, built against zookeeper_mt library) is shown in
this example, but you could also use cli_st (singlethreaded, built
against zookeeper_st library):

$ cli_mt zookeeper_host:9876

To start a client with read-only mode enabled, use the -r flag:

$ cli_mt -r zookeeper_host:9876

This is a client application that gives you a shell for executing
simple zookeeper commands. Once successfully started and connected to
the server it displays a shell prompt.

You can now enter zookeeper commands. For example, to create a node:

> create /my_new_node

To verify that the node's been created:

> ls /

You should see a list of nodes who are the children of the root node "/".

Here's a list of command supported by the cli shell:

ls -- list children of a znode identified by . The
command set a children watch on the znode.
get -- get the value of a znode at
set -- set the value of a znode at to
create [+e|+s] -- create a znode as a child of znode ;
use +e option to create an ephemeral znode,
use +s option to create a znode with a sequence number
appended to the name. The operation will fail if
the parent znode (the one identified by ) doesn't
exist.
delete -- delete the znode at . The command will fail if the znode
has children.
sync -- make sure all pending updates have been applied to znode at
exists -- returns a result code indicating whether the znode at
exists. The command also sets a znode watch.
myid -- prints out the current zookeeper session id.
quit -- exit the shell.

In order to be able to use the zookeeper API in your application you have to
1) remember to include the zookeeper header
#include
2) use -DTHREADED compiler option to enable Sync API; in this case you should
be linking your code against zookeeper_mt library

Please take a look at cli.c to understand how to use the two API types.
(TODO: some kind of short tutorial would be helpful, I guess)