ESRally离线安装与测试(easybuilderpro离线模拟)
off999 2024-10-04 00:31 32 浏览 0 评论
一、背景与介绍
(1)ESRally介绍:
ESrally是Elastic官方的,基于用户视角的对elasticsearch进行测试的工具。
术语:
- rally:汽车拉力赛
- track:赛道,压测方案。 在 Rally 中,每一次测试用的数据,都可以称之为 Track,不同的 Track 意味着不同的测试数据。
- team/car: es instance,在 Rally 中,每一个参与测试的集群,都可以称之为 car ,不同的集群就是不同的 car,如果你是在选配置,则可以通过切换 car 来设置不同配置的测试。
- race: 一场比赛,在 Rally 中,每一次测试都可以称之为 race
- tournament: 锦标赛
- challange:在 Rally 中,每一个 challange 意味着一个不同的测试场景,具体的场景则代表着 ElasticSearch 所执行的操作。
(2)测试背景与介绍
因为是生产环境,整个环境与互联网隔离。查看ESRally安装步骤,需要安装Python3、Git、JDK等,并且每个环境都有严格的版本要求,由于生产环境采用Centos7.9,Python3、Git、JDK均不符合版本要求,升级更新版本操作风险较高,故采用docker离线部署的方式。
二、测试步骤
(1)docker环境安装
1、Docker安装包下载:
https://download.docker.com/linux/static/stable/x86_64/
下载对应的安装包,此处可以使用最新安装包,我使用的版本是docker-20.10.9.tgz
2、准备docker.service 系统配置文件
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
3、准备安装脚本和卸载脚本
安装脚本 install.sh
#!/bin/sh
echo '解压tar包...'
tar -xvf $1
echo '将docker目录移到/usr/bin目录下...'
cp docker/* /usr/bin/
echo '将docker.service 移到/etc/systemd/system/ 目录...'
cp docker.service /etc/systemd/system/
echo '添加文件权限...'
chmod +x /etc/systemd/system/docker.service
echo '重新加载配置文件...'
systemctl daemon-reload
echo '启动docker...'
systemctl start docker
echo '设置开机自启...'
systemctl enable docker.service
echo 'docker安装成功...'
docker -v
卸载脚本 uninstall.sh
#!/bin/sh
echo '删除docker.service...'
rm -f /etc/systemd/system/docker.service
echo '删除docker文件...'
rm -rf /usr/bin/docker*
echo '重新加载配置文件'
systemctl daemon-reload
echo '卸载成功...'
4、安装
此时目录为:(只需要关注docker-20.10.9.tgz、docker.service、install.sh、uninstall.sh即可)
执行脚本 sh install.sh docker-20.10.9.tgz
查看docker 版本:docker -v
PS:如果需要卸载,操作如下:sh [uninstall.sh](<http://uninstall.sh/>)
(2) ESRally配置与安装
1、ESRally Docker image下载
(a)通过docker registry下载。
https://hub.docker.com/r/elastic/rally
在可以连通外网的docker环境上运行 docker pull elastic/rally 下载最新版本rally。
下载完成后,输入命令
docker save -o rally.docker elastic/rally
(b)作者已经构建好相关镜像,直接下载。
链接:https://pan.baidu.com/s/1FNs7dLbtE3aDZFbMlI_INQ 提取码:o2gh
2、镜像加载
docker load -i tensorflow_image.docker
3、ESRally配置
笔者尝试了网上很多方法,包括官网描述的offline安装步骤。
https://esrally.readthedocs.io/en/latest/install.html#offline-install
但是offline步骤也需要安装基础的环境,且通过docker环境进行volume绑定时,即使把benchmark相关的git工程下载下来,放到对应目录还是不行,因为整个过程中,rally会通过checkout命令获取对应的最新分支,而做checkout时,还是需要连接网络。
通过很多尝试,笔者使用了track-path的方式进行操作。具体步骤如下:
(A)下载对应测试数据集
http://benchmarks.elasticsearch.org.s3.amazonaws.com/corpora/geonames/documents-2.json.bz2
解压后,得到文件documents-2.json
(B)生成配置文件
生成 index.json 文件
{
"settings": {
"index.number_of_replicas": 0
},
"mappings": {
"docs": {
"dynamic": "strict",
"properties": {
"geonameid": {
"type": "long"
},
"name": {
"type": "text"
},
"latitude": {
"type": "double"
},
"longitude": {
"type": "double"
},
"country_code": {
"type": "text"
},
"population": {
"type": "long"
}
}
}
}
}
生成 track.json 文件
{
"version": 2,
"description": "Tutorial benchmark for Rally",
"indices": [
{
"name": "geonames",
"body": "index.json",
"types": [ "docs" ]
}
],
"corpora": [
{
"name": "rally-tutorial",
"documents": [
{
"source-file": "documents.json",
"document-count": 11658903,
"uncompressed-bytes": 1544799789
}
]
}
],
"schedule": [
{
"operation": {
"operation-type": "delete-index"
}
},
{
"operation": {
"operation-type": "create-index"
}
},
{
"operation": {
"operation-type": "cluster-health",
"request-params": {
"wait_for_status": "green"
},
"retry-until-success": true
}
},
{
"operation": {
"operation-type": "bulk",
"bulk-size": 5000
},
"warmup-time-period": 120,
"clients": 8
},
{
"operation": {
"operation-type": "force-merge"
}
},
{
"operation": {
"name": "query-match-all",
"operation-type": "search",
"body": {
"query": {
"match_all": {}
}
}
},
"clients": 8,
"warmup-iterations": 1000,
"iterations": 1000,
"target-throughput": 100
}
]
}
其中
{
"source-file": "documents.json",
"document-count": 11658903,
"uncompressed-bytes": 1544799789
}
需要按照情况生成,source-file为刚刚解压的文件名称,document-count使用wc -l documents.json 生成;uncompressed-bytes 如果为MacOS使用命令stat -f %z documents.json。如果是Linux系统,使用stat -f %z documents.json 得到。
将该文件夹打包后,放置在生产环境对应的目录下,笔者存放在 /home/test/rally/benchmarks/data/single
(C)运行名称查看track情况
docker run -v /home/test/rally/:/rally/.rally/ elastic/rally list tracks --track-path=/rally/.rally/benchmarks/data/single
(D)运行测试
docker run -v /home/test/rally:/rally/.rally elastic/rally race --pipeline=benchmark-only --target-hosts=10.142.3.6:9200 --track-path=/rally/.rally/benchmarks/data/rally-tutorial --client-options="basic_auth_user:'xxx',basic_auth_password:'xxx'" --offline --report-format=csv --report-file=/rally/.rally/benchmarks/result.csv
Tips:
basic_auth_user:'xxx',basic_auth_password:'xxx':如果使用了认证,可以通过该参数
pipeline=benchmark-only: docker的esrally只能使用该模式进行测试。该模式表示当前存在集群,对该集群进行压力测试。
report-file : 对应的报告输出地址。
offline :采用离线方式测试。
测试结果如图所示:
三、后记
后续,笔者将测试用例打包至docker镜像中,只需执行命令即可。
参考文献:
https://esrally.readthedocs.io/en/stable/adding_tracks.html?highlight=track-path#creating-a-track-from-scratch
http://download.geonames.org/export/dump/allCountries.zip
http://esrally.lyremelody.org/zh_CN/latest/index.html
Tips:
1、Docker 绑定volume时报:permission not allow 可以对绑定账号赋权777
相关推荐
- 连wifi就能打电话的软件(无卡用wifi打电话)
-
我的手机是安卓2.2系统所有这里只针对Android2.2系统其他系统版本的朋友可以试一试需要一款拨号软件:PPPOE拨号软件;而拨号软件必须要获得root权限(管理权限)才能拨号;下载安装这...
- wifi优化大师下载(wifi优化软件)
-
1.设定-应用程序管理器-已下载-单击需要卸载的软件-卸载。2.点击最近应用程序键-进入任务管理器-已下载-点击""""卸载""""。3...
- 无网络单机游戏(好玩的无网络单机游戏)
-
一款能够让我们自由畅快的进行游戏的合集软件。在这个合集之中有着各种各样的单机小游戏。这些小游戏不需要联网就可以玩了,没有防沉迷系统,我们想玩多久就玩多久,合集之中小游戏的类型有很多种,有赛车类、射击类...
- 笔记本电脑推荐理由(推荐笔记本子)
-
配置落后散热出现问题是笔记本报废的主要原因因为旧电脑问题很多。一是现在新电脑价格不算贵,没必要用旧的,电脑可不兴新不如旧的说法;二是二手电脑是否大修过,是否有什么瑕疵,是否运行速度有问题,是否被人监控...
- tplink设置向导(tp link路由器的设置向导)
-
tplink路由器首次设置时才会自动弹出向导,如果希望自动弹出,可先还原出厂设置,然后再登录即可自动弹出,还原出厂设置步骤如下: 1、路由器开启电源; 2、按下路由器表面的reset复位按钮,个别...
- 破解苹果激活锁的万能id(破解iphone id激活锁软件)
-
提前打开我的AppleID界面,点击管理您的账户。点击忘记AppleID,填写与AppleID相关的各项基本信息。通过电子邮件内的链接或回答安全问题,或者进行人工破解。1、登陆苹果官网,点击下面...
- 手机上不了wifi是什么原因(手机上不了网连不了wifi)
-
1.手机wifi已连接不可上网问题出现后首先检测一下是否为手机本身突发性的问题,可以进行关机重启一下再连接看是否还会出现这样的情况。或者使用其他手机或设备连接WiFi试试能否上网。2.如果不是手机的问...
- win10有产品id没有密钥(win10 我没有产品密钥)
-
WIN10,在左下角输入WINDOWSPOWERSHELL,然后点击系统查询结果第一项,在弹出的窗口中输入:(Get-WmiObject-query‘select*fromSoftware...
- win10截屏后找不到了(win10截屏后找不到了怎么办)
-
Win10系统截屏后没有更新通知并不是一个常见的问题。可能是由于系统设置或者安装的软件造成的。如果系统设置为静音或者禁用通知,那么截屏后不会有通知。另外,一些截屏软件可能会阻止系统通知,需要手动设置...
- 运行定时关机命令(运行定时关机命令怎么设置)
-
1、打开电脑,按住【Win+R】组合键,弹出运行命令,在编辑框内输入如下命令:shutdown-s-t3600;电脑定时关机运行2、shutdown-s-t3600命令的含义如下:shut...
- 键盘快捷键(键盘快捷键是哪个)
-
电脑键盘快捷键大全:Ctrl+1,2,3... 功能:切换到从左边数起第1,2,3...个标签Ctrl+A 功能:全部选中当前页面内容Ctrl+C 功能:复制当前选中内容Ctrl+D 功能:打开“添加...
- 宏基acer官网商城(宏基官方商城)
-
宏碁本本底部有个序列号标签,不是粉色的那个,粉色的是系统的序列号,白色的是本本的出厂序列号,上宏碁官网查查你的序列号就知道真假了。在盖子的后面就可以查询到序列号,或者是去网上查询宏碁笔记本在官网下...
欢迎 你 发表评论:
- 一周热门
-
-
抖音上好看的小姐姐,Python给你都下载了
-
全网最简单易懂!495页Python漫画教程,高清PDF版免费下载
-
Python 3.14 的 UUIDv6/v7/v8 上新,别再用 uuid4 () 啦!
-
python入门到脱坑 输入与输出—str()函数
-
飞牛NAS部署TVGate Docker项目,实现内网一键转发、代理、jx
-
宝塔面板如何添加免费waf防火墙?(宝塔面板开启https)
-
Python三目运算基础与进阶_python三目运算符判断三个变量
-
(新版)Python 分布式爬虫与 JS 逆向进阶实战吾爱分享
-
慕ke 前端工程师2024「完整」
-
失业程序员复习python笔记——条件与循环
-
- 最近发表
- 标签列表
-
- python计时 (73)
- python安装路径 (56)
- python类型转换 (93)
- python进度条 (67)
- python吧 (67)
- python的for循环 (65)
- python格式化字符串 (61)
- python静态方法 (57)
- python列表切片 (59)
- python面向对象编程 (60)
- python 代码加密 (65)
- python串口编程 (77)
- python封装 (57)
- python写入txt (66)
- python读取文件夹下所有文件 (59)
- python操作mysql数据库 (66)
- python获取列表的长度 (64)
- python接口 (63)
- python调用函数 (57)
- python多态 (60)
- python匿名函数 (59)
- python打印九九乘法表 (65)
- python赋值 (62)
- python异常 (69)
- python元祖 (57)
