jmeter分布式:jmeter.properties配置
参考资料
https://my.oschina.net/u/4411233/blog/3523962
https://www.cnblogs.com/mudingxi/p/12725932.html
配置前请保证
-
master能和salve机相互ping通
注意代理
-
master和salve机版本一致
jdk, jmeter版本最好都一致
-
自行配置好了Jdk,jmeter环境,下面是/etc/profile环境变量实例,仅供参考
需要切换成个人的jdk目录和jmeter目录
# Java环境变量 是salve机中 jdk的目录位置 export JAVA_HOME=/root/jdk1.8.0_202 export PATH=$JAVA_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar # jmeter /root/apache-jmeter-4.0 是salve机中 jmeter的目录位置 export PATH=/root/apache-jmeter-4.0/bin:$PATH
-
需要将salve机里面jmeter/bin 目录下 执行 chmod 777 * (linux 赋予最高权限,该目录下所有内容)
master配置
"apache-jmeter-4.0\bin\jmeter.properties",jmeter目录下的jmeter.properties, 快捷修改下面两处即可
...
# Remote Hosts - comma delimited
# salve机IP
remote_hosts=192.168.0.201:1099,192.168.0.213:1099
#remote_hosts=localhost:1099,localhost:2010
...
# Set this if you don't want to use SSL for RMI
# server.rmi.ssl.disable=false
server.rmi.disable=true
#---------------------------------------------------------------------------
# Include Controller
#---------------------------------------------------------------------------
...
salve机配置
jmeter.properties 修改如下
...
# Remote Hosts - comma delimited
remote_hosts=127.0.0.1
#remote_hosts=localhost:1099,localhost:2010
# RMI port to be used by the server (must start rmiregistry with same port)
server_port=1099
# To change the port to (say) 1234:
# On the server(s)
# - set server_port=1234
# - start rmiregistry with port 1234
# On Windows this can be done by:
# SET SERVER_PORT=1234
# JMETER-SERVER
...
# To use a specific port for the JMeter server engine, define
# the following property before starting the server:
# server.rmi.localport=1099
server.rmi.localport=1099
# The jmeter server creates by default the RMI registry as part of the server process.
# To stop the server creating the RMI registry:
#server.rmi.create=false
...
#server.rmi.ssl.truststore.password=changeit
#
# Set this if you don't want to use SSL for RMI
# server.rmi.ssl.disable=false
server.rmi.ssl.disable=true
#---------------------------------------------------------------------------
# Include Controller
#---------------------------------------------------------------------------
# Prefix used by IncludeController when building file name
#includecontroller.prefix=
...
salve机启动jmeter-server
jmeter-server -Djava.rmi.server.hostname=salve机IP
成功实例
[root@localhost ~]# jmeter-server -Djava.rmi.server.hostname=192.168.0.201
Using local port: 1099
Created remote object: UnicastServerRef2 [liveRef: [endpoint:[192.168.0.201:1099](local),objID:[-3a26b868:177719a586a:-7fff, 415585591331621556]]]
no gui 模式启动分布式测试
-
运行所有配置好的salve机
# 启动所有slave机 结果文件后缀可以是jtl csv html报告路径必须是空的,结果文件不能已存在 # jmeter -n -t jmx脚本 -r -l 结果文件 -e -o html报告地址 jmeter -n -t D:\HTTP请求.jmx -r -l resutl.jtl -e -o D:\report
-
运行指定IP的salve机
# 分布式运行jmeter no gui 指定对应slave机 # jmeter -n -t 脚本.jmx -l 结果.jtl -H slave机IP -P slave机端口(默认1099) -e -o html报告保存目录(需要是个空目录) jmeter -n -t D:\HTTP请求.jmx -H 192.168.0.201 -P -l resutl.jtl -e -o D:\report
成功实例
-
salve机
Starting the test on host 192.168.0.213:1099 @ Fri Feb 05 17:15:08 CST 2021 (1612516508755) Finished the test on host 192.168.0.213:1099 @ Fri Feb 05 17:15:10 CST 2021 (1612516510087)
-
master机
Configuring remote engine: x.x.x.x:1099 Configuring remote engine: x.x.x.x:1099 Starting remote engines Starting the test @ Fri Feb 05 18:00:43 CST 2021 (1612519243358) ...