Elasticsearch性能测试工具rally深入详解题记
elasticsearch性能测试研究了很久,自己想过通过批量导入数据,然后记录时间,统计CPU、内存等变化,计算得出某个性能指标。但显然,数据量起伏不定,非常不准确。
研究发现,github上提供了rally作为elasticsearch的性能测试工具,较好的解决了es性能测试问题。
1、esrally功能:es的性能测试工具。
esrally不支持windows版本,目前只支持Linux和Mac OS。
esrally的运行基于以下两点假设:
1)所有运行在同一台机器完成。(未来改假设条件可能会去掉)
2)你需要向Elasticsearch索引中添加特定的数据集,然后在其上进行基准查询(benchmarking queries).
2、esrally安装:
前提:验证是否安装了以下内容(注意版本)
Python 3.4+ available as python3 on the path (verify with: python3 –version which should print Python 3.4.0 or higher)
pip3 available on the path (verify with pip3 –version)
JDK 8
git
如下所示:
[root@laoyang git-2.4.0]# python
Python 3.5.1 (default, Aug 2 2016, 09:53:20)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux
Type "help", "copyright", "credits" or "license" for more information.
[root@laoyang git-2.4.0]# git --version
git version 2.4.0
[root@laoyang git-2.4.0]# java -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
[root@laoyang git-2.4.0]# find / -name "pip3"
/usr/bin/pip3
/usr/local/python3/bin/pip3
步骤1:安装 Rally
pip3 install esrally
步骤2:配置 Rally
调用: esrally configure 会提示让你输入 java8.home(也就是JAVA_HOME设定的环境变量路径)。
仅java8.home使用自己本机的JAVA_HOME环境变量路径,其他采用默认值即可。
[root@laoyang .rally]# cat /root/.rally/rally.ini
[meta]
config.version = 5
[system]
root.dir = /root/.rally/benchmarks
log.root.dir = logs
env.name = local
[source]
local.src.dir=/root/.rally/src #注意,此路径并非elaticsearch安装路径。
remote.repo.url=https://github.com/elastic/elasticsearch.git
[p