ESRally安装
运行ESRally需要依赖Python3,Git。本篇是针对Centos7系统。
安装依赖
安装Python3
yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel
解压Python-3.5.0.tgz安装包
sudo mkdir /usr/local/python3
sudo Python-3.5.0/configure --prefix=/usr/local/python3
sudo make
sudo make install
Centos7自带了Python2.7,需要升级到Python3
1 备份原版python2.7
sudo mv /usr/bin/python /usr/bin/python.bak
2 创建连接
sudo ln -s /usr/local/python3/bin/python3 /usr/bin/python
3 创建pip连接
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
4 修改yum
sudo vi /usr/bin/yum
python -> python2
安装Git
ESRally要求git的版本>=1.9
1.依赖
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
yum install gcc perl-ExtUtils-MakeMaker
2.解压
3.安装
make prefix=/usr/local/git all
make prefix=/usr/local/git install
echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/profile
source /etc/profile
git --version
安装ESRally
使用esrally-dist-1.3.0.tar.gz安装包
tar -xzf esrally-dist-1.3.0.tar.gz
sudo ./esrally-dist-1.3.0/install.sh
ln -s /usr/local/python3/bin/esrally /usr/bin/esrally
数据准备
Esrally提供了自动下载数据集的脚本
curl -O https://raw.githubusercontent.com/elastic/rally-tracks/master/download.sh
chmod u+x download.sh
下载geonames数据集
./download.sh geonames
拷贝到目标机器后,解压在当前用户的根目录
tar -xvf rally-track-data-geonames.tar -C ~/
ESRally测评
运行一次基准测试
运行一次基准测试称为一次race
esrally race --pipeline=benchmark-only --target-hosts=10.202.77.206:9200 --offline --track=geonames --challenge=append-no-conflicts
参数说明:
--pipeline
from-sources-complete 编译并运行ES,执行benchmarks并生成报告
from-sources-skip-build 跳过编译运行ES,执行benchmarks并生成报告
from-distribution 下载ES发行版,执行benchmarks并生成报告
benchmark-only 在已经运行的ES实例上,执行benchmarks并生成报告
--target-hosts 指定ES地址
--offline 离线模式
--report-format {markdown,csv}
Define the output format for the command line report (default: markdown).
--report-file REPORT_FILE
--report-file REPORT_FILE
Write the command line report also to the provided file.
查看运行记录
esrally list races
对比基准测试运行结果
比较不同 race 的结果称为一次tournament
esrally compare --baseline= bc39a7d2-90b8-4b44-9498-9ec3dac49d80 --contender= ac490a91-68cc-4c48-9bfe-78005c2debc7
连接
https://esrally.readthedocs.io/en/stable/