Elasticsearch压测 - Rally安装使用

2023-03-31,,

1.     安装

这篇文章详细描述了安装Rally

1.1.   前置条件

在安装Rally之前请确保以下包已经安装成功

  • Python3.4+ (验证python3 --version应该打印 Python 3.4.0或以上)

   pip3(验证pip3 --version)

  • JDK8

  • git1.9+

  • Gradle2.13+(可选如果需要从源代码编译则需要)

  • root用户(由于ES2.0需要非root运行Rally也必须以非root运行)

1.2.   安装Rally

sudo pip3 install esrally

2.     配置

安装完成后需要配置Rally。首次运行esrally将会检测配置文件是否丢失然后询问你一些问题

./esrally

3.     运行Races

“race”表示Rally一次压测过程。你可以使用不同的数据集(称之为tracks)来进行压测。

3.1.   Tracks列表

./esrally list tracks

3.2.   运行race

默认执行geonames track需要下载可以自行下载数据集

http://benchmarks.elasticsearch.org.s3.amazonaws.com/corpora/geonames/documents.json.bz2

将下载文件放入/home/User/.rally/benchmarks/data/geonames

3.2.1.     默认压测

./esrally --distribution-version=2.2.1

此次将会下载elasticsearch-2.2.1.tar.gz包并将此包放入/home/User/.rally/benchmarks/distributions你也可以自己下载放入此中

3.2.2.     压测插入

./esrally --distribution-version=2.2.1
--challenge=append-fast-no-conflicts --pipeline=benchmark-only

3.2.3.     压测更新

./esrally --distribution-version=2.2.1
--challenge=append-fast-with-conflicts --pipeline=benchmark-only

3.2.4.     压测已存在的es环境

当已经存在Elasticsearch部署环境则可以使用--target-hosts来指定

./esrally --target-hosts=172.16.54.135:9200
--challenge=append-fast-no-conflicts --pipeline=benchmark-only