ESRally离线安装与测试(easybuilderpro离线模拟)
off999 2024-10-04 00:31 38 浏览 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
相关推荐
- windows无法激活(windows无法激活有什么影响)
-
1.如果修复或重新组装了电脑,则可能是安装了不同版本的Windows。或者,如果在修复过程中为电脑使用了其他产品密钥,当使用该密钥的电脑数大于Microsoft软件许可条款允许的电脑数时,该密钥...
-
- u盘文件恢复软件免费(恢复u盘数据免费的软件)
-
u盘损坏文件恢复方法:1、打开电脑桌面的“计算机”或“我的电脑”。2、然后再找到需要修复的u盘。3、打开“运行”窗口(可以直接按“Windows+R”快捷打开),输入“CMD”并点击“确定”按钮以进入命令提符界面。4、从打开的“命令提示符”...
-
2025-12-28 22:03 off999
- 电脑uac是什么意思
-
UAC就是用户帐户控制,在对计算机进行更改之前,用户帐户控制(UAC)会通知您。比如安装软件驱动什么的,默认UAC设置会在程序尝试对计算机进行更改时通知您,但您可以通过调整设置来控制UAC...
- 笔记本找不到自己家的wifi怎么办
-
1.笔记本电脑缺少无线网卡驱动,需要下载驱动如果笔记本电脑开机之后,无法显示WiFi网络的图标,这个时候多半是因为电脑缺少无线网卡驱动造成的,有时候自己在清理电脑的时候,不小心清理了驱动程序,便会...
- 电信宽带办理电话是多少(电信宽带办理联系电话)
-
电信宽带不一定需要电信手机号码,可以根据自身需要选择,有单独的宽带业务,一般要求预存一定时间的使用费。不过一般包含了宽带、手机号码的融合套餐总体上更优惠,对客户来说更划算。如果有相应需求的话,建议同时...
- 开机进入ghost启动项(电脑启动进入ghost)
-
电脑启动的时候进入GHOST界面方法: 1、首先确认电脑装了GHOST软件。 2、重启电脑,注意仔细观察电脑屏幕,会有一个3s或者10s的选择界面。让选择是进入GHOST界面,或者正常启动进入系...
- 华硕bios修复蓝屏图解(华硕bios修复蓝屏视频教程)
-
先看下BIOS是否可以识别到硬盘设备,若看不到,硬盘故障的可能性很大。若可以看到硬盘,建议先尝试进行BIOS兼容性设置:1,在BIOS界面,通过方向键进【Secure】菜单,通过方向键选择【Sec...
- 老电脑怎么装win7系统(老电脑装win7系统可以吗)
-
6年前的电脑,如果是用的当时最新的CPU的话,应该是第7代或者第6代酷睿等级的。运行windows7和windows10都应该没有压力。从软件的兼容性来说,还是建议安装windows10,因为现在有好...
- 电脑怎么设置到点自动关机(电脑怎样设置到点关机)
-
1、首先我们点击电脑屏幕左下角的开始按钮,在所有程序里依次选择附件---系统工具,接着打开任务计划程序。2、我们打开任务计划程序后,在最右边的操作框里选择创建基本任务,然后在创建基本任务对话框的名称一...
- 2025年笔记本电脑排行榜(20201年笔记本电脑推荐)
-
2023华为笔记本电脑matebook16系列很好用的。因为这个系列她是有非常好的性价,比的是能够让你有非常轻薄的厚度,并且能够有11.6寸的屏幕,而且还有120赫兹的刷新率作为大学生,您可能需要经常...
- powerpoint激活密钥(ppt密钥 激活码2010)
-
1/4进入文件打开一个PPT文件进入到软件界面,在界面左上方找到文件选项,点击该选项进入到文件页面。2/4点击账户文件页面中,页面左侧找到账户选项,点击该选项,页面右侧会出现相应的操作选择。3/4点击...
-
- qq恢复删除好友官网(qq恢复已删好友)
-
qq恢复官方网站,http://huifu.qq.com/1、什么是QQ恢复系统?QQ恢复系统是腾讯公司提供的一项找回QQ联系人、QQ群的服务,向所有QQ用户免费开放。2、QQ恢复系统能恢复多长时间内删除的好友?普通用户可以申请恢复3个月内...
-
2025-12-28 16:03 off999
欢迎 你 发表评论:
- 一周热门
-
-
抖音上好看的小姐姐,Python给你都下载了
-
全网最简单易懂!495页Python漫画教程,高清PDF版免费下载
-
Python 3.14 的 UUIDv6/v7/v8 上新,别再用 uuid4 () 啦!
-
飞牛NAS部署TVGate Docker项目,实现内网一键转发、代理、jx
-
python入门到脱坑 输入与输出—str()函数
-
宝塔面板如何添加免费waf防火墙?(宝塔面板开启https)
-
Python三目运算基础与进阶_python三目运算符判断三个变量
-
(新版)Python 分布式爬虫与 JS 逆向进阶实战吾爱分享
-
失业程序员复习python笔记——条件与循环
-
系统u盘安装(win11系统u盘安装)
-
- 最近发表
- 标签列表
-
- 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)
