ES官网压测工具-rally安装使用浅析
说明
rally依赖于java,pip,python3,git。版本要求如下:
* java
:1.8以上
* pip
:9.0以上
* python
:3.0以上
* git
:1.9以上
安装python3
- 安装必要的包
yum install -y openssl-devel bzip2-devel
备注:如果不安装openssl-devel、bzip2-devel在配置过程中会报错,并需要安装后重新编译。
- 编译安装
## 下载python3
## 解压
tar zxvf Python-3.6.1.tgz
cd Python-3.6.1
## 编译安装
./configure --with-ssl //--with-ssl为开启SSL模式,pip配置需要ssl模块
make
make install
## 验证
python3 --version
$]# Python 3.6.1
若未启用ssl模块将报错:
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
安装git
rally需要git版本在1.9以上,当前我们将安装2.9.2版本(大于1.8即可)
- 安装相关软件包
yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
yum install -y asciidoc xmlto autoconf
- 安装git
## 删除旧版本
yum remove git
## 下载
wget https://github.com/git/git/archive/v2.9.2.tar.gz
## 编译安装
tar zxvf v2.9.2.tar.gz
cd git-2.9.2
make configure
./configure --prefix=/usr/local/git --with-iconv=/usr/local/libiconv
make all doc
make install install-doc install-html
## 创建软链接
ln -s /usr/local/git/bin/git /usr/bin/git
## 验证
git -version
$]# git version 2.9.2
安装esrally
- 下载安装esrally
pip3 install esrally
- 首次配置
esrally configure
## 命令后将会检测你的环境,以及需要填写JAVA_HOME。
小护贴:可能yum安装java的小伙伴不知道怎么查看自己的JAVA_HOME,请直接查看文章最后的
JAVA_HOME说明
。
使用esrally
esrally的原理就是用一些数据去灌入es然后对这些数据灌入的过程自动生成详细的车上报告,其中esrally自动了很多规则库。如下:
esrally list tracks
补充信息:由于esrally的数据源都是在国外(目前我没有找到国内源,如果大家有希望留言给我),所以拉去数据源的过程会异常缓慢
运行第一个测试
esrally --track=percolator --target-hosts=192.168.81.101:39202,192.168.81.102:39202,192.168.81.103:39202 --pipeline=benchmark-only
- 测试结果
说明
- track:指定数据源
- target-hosts:指定本地集群信息
- pipeline:指定管道模式
其中在官网对pipeline的解释是:
Your requirement | Recommendation |
---|---|
You want to use Rally’s telemetry devices | Use Rally daemon, as it can provision the remote node for you |
You want to benchmark a source build of Elasticsearch | Use Rally daemon, as it can build Elasticsearch for you |
You want to tweak the cluster configuration yourself | Use Rally daemon with a custom configuration or set up the cluster by yourself and use –pipeline=benchmark-only |
You need to run a benchmark with plugins | Use Rally daemon if the plugins are supported or set up the cluster by yourself and use –pipeline=benchmark-only |
You need to run a benchmark against multiple nodes | Use Rally daemon if all nodes can be configured identically. For more complex cases, set up the cluster by yourself and use –pipeline=benchmark-only |
自制track
由于官方提供的数据源下载异常缓慢,简直就是没法用。可以考虑自制数据源方案。
* 官网自制track教程通道
自制track方式
将后期补充自制track教程
JAVA_HOME说明
鉴于很多小伙伴如果是yum安装的java,对自己的JAVA_HOME肯定是一脸懵逼。因为没有这个变量。
## 查看JAVA_HOME
echo $JAVA_HOME
$ (空)
## 查看java命令位置
whereis java
$ java: /usr/bin/java /usr/share/man/man1/java.1
## 查看java命令路径属性
ls -l /usr/bin/java
$ lrwxrwxrwx. 1 root root 22 Jun 28 14:17 /usr/bin/java -> /etc/alternatives/java
## 咦,看见没,有个软链接,接着来,继续查看/etc/alternatives/java
ls -l /etc/alternatives/java
$ lrwxrwxrwx. 1 root root 35 Jun 28 14:17 /etc/alternatives/java -> /usr/java/jdk1.8.0_112/jre/bin/java
ls -l /usr/java/jdk1.8.0_112/jre/bin/java
$ -rwxr-xr-x. 1 root root 7734 Sep 23 2016 /usr/java/jdk1.8.0_112/jre/bin/java
## 好啦,那么$JAVA_HOME就浮现出来啦
/usr/java/jdk1.8.0_112/jre