install and use zookeeper C client API

2286 ワード

1.install zookeeper in cluster
前のSTORMを参考に取り付けます。  http://www.cnblogs.com/Torstan/archive/2013/03/07/2948319.html
2.install zookeerper C client API
cd zookeeper-33.5/src/c
at reconf-if
If this happens,we need install cppunit 1.10.2 .
 $ autoreconf -if

>> aclocal:configure.ac:33: warning: macro `AM_PATH_CPPUNIT' not found in

>> library

>> aclocal:configure.ac:33: warning: macro `AM_PATH_CPPUNIT' not found in

>> library

>> configure.ac:33: error: possibly undefined macro: AM_PATH_CPPUNIT

>>       If this token and others are legitimate, please use m4_pattern_allow.

>>       See the Autoconf documentation.

>> autoreconf: /usr/bin/autoconf failed with exit status: 1

We can see there is no directory named with /usr/local/share/aclocal.
2.1 install cppuint 1.10.2
ダウンロード cppunit-cvs-1.10.2.tar.gz
tar xzvf cppunit-cvs-1.10.2.tar.gz
cd cppunit-cvs-1.10.2
sh atogen.sh
./configure
make&make install
So。 cppuint 1.10.2 has been installed in /usr/local/share/aclocal.
 
We continue to install zookeeper C client API. See https://issues.apache.org/jira/browse/ZOOKEEPER-1454 
ACLOCAL=「aclocal-I/usr/local/share/aclocal」 at reconf-if
./configure
make&make install
 
3.use zookeeper C client API
cd zookeeper-33.5/src/c/src/
there is a file cli.c,we can comple it into a binary,cli,with the follwing Makefile.
[Torstan]嗳more Makefile all:g+-c-I/uscal/include/c-client-src-I/user/local/zookeeper-33.5/src/c/c/include cli.o/user/loliper/localst.aclean:rm cli cli.o
 
make clean;メーク
[Torstan]菗.cli 127..0.1:2181 Watch-1 state=CONNETED_STATEGot a new session id:0 x 3 d 3564 f 27 e 0021 ls/time=0 msec/:rc=0 hello storm zookeeper zk_test ginaobilitye=0 msec
 
For more information,please refer to  http://zookeeper.apache.org/doc/r3.2.2/zookeeperOver.html