使用zk-smoketest測試zookeeper

ou7340 8年前發布 | 37K 次閱讀 測試工具

來自: http://my.oschina.net/u/1241970/blog/613240


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</pre>

 

使用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</pre>

 

具體使用請參考: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;

  4. </ol>

 本文由用戶 ou7340 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!