1、由于perl的zookeeper扩展包Net::zookeeper需要使用ZK本身的C client,因此需要在机器上去安装Zookeeper C client。
Zookeeper C client 的实现在 src/c 目录下,进入到该目录安装 Zookeeper C client,步骤如下:
$ ./configure $ make $ sudo make install //需要root权限,否则不能安装成功
2、安装Net::zookeeper
在编译的过程中一定要指明--zookeeper-include、--zookeeper-lib。
perl Makefile.PL --zookeeper-include=/data/home/tdsql/zookeeper-3.4.6/src/c/include --zookeeper-lib=/usr/local/bin make make test //测试模块是否成功 make install //安装
测试前需要
export LD_LIBRARY_PATH=/usr/local/lib
之后执行
make test
若测试成功则输出
[[email protected] /data/home/summer/onlineddl/Net-ZooKeeper-0.41]# make test PERL_DL_NONLAZY=1/usr/bin/perl "-MExtUtils::Command::MM""-e""test_harness(0, ‘blib/lib‘, ‘blib/arch‘)" t/*.t t/10_invalid.t ....1/107# no ZooKeeper hostnames specified in ZK_TEST_HOSTS env var, using localhost:2181 # no ZooKeeper path specified in ZK_TEST_PATH env var, using root path t/10_invalid.t .... ok t/15_thread.t ..... ok t/20_tie.t ........ ok t/22_stat_tie.t ... ok t/24_watch_tie.t .. ok t/30_connect.t .... ok t/35_log.t ........ ok t/40_basic.t ...... ok t/45_class.t ...... ok t/50_access.t ..... ok t/60_watch.t ...... ok All tests successful. Files=11,Tests=463,17 wallclock secs (0.06 usr 0.00 sys +0.14 cusr 0.02 csys =0.22 CPU) Result: PASS
至此全部安装完成。
时间: 2024-10-20 23:43:12