使用zk-smoketest测试zookeeper

zookeeper提供了一个smoke test的工具:zk-smoketest.(https://github.com/phunt/zk-smoketest)

要使用该工具得先准备环境:

本示例中使用的zookeeper版本是zookeeper-3.4.7。

1.因需要使用gcc进行编译,需安装gcc:

yum install gcc


2.使用到ant,安装ant:

 yum install ant

3.zk-smoketest使用的是python客户端,所以如果当前机器未安装python,需要安装python:

4.同时需要安装python-devel,否则会报错:提示找不到Python.h

yum -y install python-devel

5.下载zookeeper-3.4.7.tar.gz,放到/opt目录下;

6.使用tar命令解压zookeeper-3.4.7.tar.gz:

tar -zxvf zookeeper-3.4.7.tar.gz

3.进入目录/opt/zookeeper-3.4.7/src/c:    

cd /opt/zookeeper-3.4.7/src/c

4.执行编译:

./configure        
make
sudo make install

5.进入目录/opt/zookeeper-3.4.7/src/contrib/zkpython:

cd /opt/zookeeper-3.4.7/src/contrib/zkpython

6.执行ant脚本:

sudo ant install

7.成功编译后,环境就准备完毕了。

8.从https://github.com/phunt/zk-smoketest下载zk-smoketest-master.zip存入到/opt目录下;

9.使用unzip命令解压zk-smoketest-master.zip:

unzip zk-smoketest-master.zip

10.进入zk-smoketest-master目录:

  cd zk-smoketest-master

这时就可以使用zk-smokettest了。

-------------------------------------------------------------------------------------------------------------------------------------

使用zk-smoketest.py:

PYTHONPATH=lib.linux-i686-2.6 LD_LIBRARY_PATH=lib.linux-i686-2.6 ./zk-smoketest.py --servers "host:port(,host:port)*"

具体参数:

Usage: zk-smoketest.py [options]

Options:
  -h, --help           show this help message and exit
  --servers=SERVERS    comma separated list of host:port (default localhost:2181)
  --config=CONFIGFILE  zookeeper configuration file to lookup servers from
  --timeout=TIMEOUT    session timeout in milliseconds (default 5000)
  -v, --verbose        verbose output, include more detail
  -q, --quiet          quiet output, basically just success/failure


使用zk-latencies.py:

PYTHONPATH=lib.linux-i686-2.6 LD_LIBRARY_PATH=lib.linux-i686-2.6 ./zk-latencies.py --servers "host:port(,host:port)*"

具体参数:

Usage: zk-latencies.py [options]

Options:
  -h, --help            show this help message and exit
  --servers=SERVERS     comma separated list of host:port (default
                        localhost:2181)
  --cluster=CLUSTER     comma separated list of host:port, test as a cluster,
                        alternative to --servers
  --config=CONFIGFILE   zookeeper configuration file to lookup servers from
  --timeout=TIMEOUT     session timeout in milliseconds (default 5000)
  --root_znode=ROOT_ZNODE
                        root for the test, will be created as part of test
                        (default /zk-latencies)
  --znode_size=ZNODE_SIZE
                        data size when creating/setting znodes (default 25)
  --znode_count=ZNODE_COUNT
                        the number of znodes to operate on in each performance
                        section (default 10000)
  --watch_multiple=WATCH_MULTIPLE
                        number of watches to put on each znode (default 1)
  --force               force the test to run, even if root_znode exists -
                        WARNING! don't run this on a real znode or you'll lose
                        it!!!
  --synchronous         by default asynchronous ZK api is used, this forces
                        synchronous calls
  -v, --verbose         verbose output, include more detail
  -q, --quiet           quiet output, basically just success/failure


具体使用请参考:https://github.com/phunt/zk-smoketest


文章参考:

  1. http://johnjianfang.blogspot.kr/2014/11/zookeeper-smoke-test.html;

  2. https://github.com/phunt/zk-smoketest;

  3. http://www.linuxidc.com/Linux/2016-01/127429.htm;

转载于:https://my.oschina.net/u/1241970/blog/613240

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值