jmeter分布式
jmeter分布式 - 1、下载jmeter5.1.1的tgz版本,然后上传到Linux
- 2、修改环境变量
- 3.发布系统环境变量
- 4、修改从机配置文件
- 5、修改主机配置文件
- 6、启动从机--Linux
- 7、启动主机--windows
- 8、非gui模式
- 问题记录
下面的slave 代表执行机的ip地址
参考文档:
https://www.cnblogs.com/S--S/p/10570735.html
如果没有jdk,需要先安装jdk
jdk下载地址:https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
1、下载jmeter5.1.1的tgz版本,然后上传到Linux
https://archive.apache.org/dist/jmeter/binaries/
解压 修改 目录名称
tar zxf apache-jmeter-5.1.1.tgz
mv apache-jmeter-5.1.1 jmeter-5.1.1
2、修改环境变量
原有变量
export JAVA_HOME=/usr/local/jdk1.8
export CLAsspATH=$:CLAsspATH:$JAVA_HOME/lib/
export PATH=$PATH:$JAVA_HOME/bin
增加以下变量
/usr/local/jmeter-5.1.1
export JMETER_HOME=/usr/local/jmeter-5.1.1
export CLAsspATH=$JMETER_HOME/lib/ext/ApacheJMeter_core.jar:$JMETER_HOME/lib/jorphan.jar:$JMETER_HOME/lib/logkit-2.0.jar:$CLAsspATH
export PATH=$JMETER_HOME/bin:$PATH:$HOME/bin
3.发布系统环境变量
source /etc/profile
下载jmter压缩包 地址: http://jmeter.apache.org/download_jmeter.cgi
4、修改从机配置文件
slave配置修改
修改 下面这一行 避免启动报错
##!
vim jmeter.properties
server.rmi.ssl.disable=true
##!!
vim jmeter-server
MI_HOST_DEF=-Djava.rmi.server.hostname=slave的IP地址
5、修改主机配置文件
jmeter.properties
修改这一行设置slave1和slave2节点的ip和端口 (可以自己调整端口在占用的其它情况下)
remote_hosts=slave1:1099,slave2:1099
master 其它不用修改
jmeter.bat
set rmi_host=-Djava.rmi.server.hostname=slave1
set ARGS=%JAVA9_OPTS% %DUMP% %HEAP% %VERBOSE_GC% %GC_ALGO% %DDRAW% %sYstem_PROPS% %JMETER_LANGUAGE% %rUN_IN_DOCKER% %rmi_host%
6、启动从机--Linux
[root@localhost bin]# ./jmeter-server
Created remote object: UnicastServerRef2 [liveRef: [endpoint:slave128:36002,objID:[633b3e1f:17a22727984:-7fff, -6981845599798428680]]]
7、启动主机--windows
bin目录下双击jmeter.bat
启动所有远程机
8、非gui模式
jmeter -n -t D:\VIP\性能\jmeter\dushi.jmx -R slave1:1099,slave128:1099 -l report.jtl -e -o D:\VIP\性能\jmeter\result
jmeter -n -t [jmx file] -l [results file] -e -o [Path to web report folder]
生成了result文件,点击index.html就可以看到报告了
运行过程如下:
Creating summariser <summary>
Created the tree successfully using D:\VIP\性能\jmeter\dushi.jmx
Configuring remote engine: slave1:1099
Using local port: 1099
Configuring remote engine: slave128:1099
Starting remote engines
Starting the test @ Sat Jun 19 18:00:51 CST 2021 (1624096851403)
Remote engines have been started
Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port 4445
Tidying up remote @ Sat Jun 19 18:01:11 CST 2021 (1624096871961)
summary = 100 in 00:00:20 = 4.9/s Avg: 1795 Min: 104 Max: 10655 Err: 0 (0.00%)
Tidying up remote @ Sat Jun 19 18:01:12 CST 2021 (1624096872150)
... end of run
... end of run
报错:
Error in NonGUIDriver java.lang.IllegalArgumentException:Results File:report: result.jtl isnot empty
解决:
删除jmeter的bin目录和用户目录下面的result.jtl文件
问题记录
- 1、jmeter-server.bat 无法启动,系统找不到指定的文件
![图 34]
(b0f711b6754b00278f8f9843b62cf2ac420fdd55d43adb0560203185af580df1.png)
解决方法:
找到如下文件:
在目录\apache-jmeter-5.1.1\bin下,打开名为jmeter.properties的文件
找到server.rmi.ssl.disable=false,改为true,并把前面的#去掉
-
2、C:\Users\gavin>jmeter -n -t D:\VIP\性能\jmeter\dushi.jmx -R slave1 -l report.jtl -e -o D:\VIP\性能\jmeter\result
Jun 19, 2021 1:55:06 PM java.util.prefs.WindowsPreferences
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
Creating summariser
Created the tree successfully using D:\VIP\性能\jmeter\dushi.jmx
Configuring remote engine: slave1
Exception creating connection to: slave1; nested exception is:
java.io.FileNotFoundException: rmi_keystore.jks (系统找不到指定的文件。)
Failed to configure slave1
Stopping remote engines
Remote engines have been stopped
Error in NonGUIDriver java.lang.RuntimeException: Following remote engines Could not be configured:[slave1]
An error occurred: Error in NonGUIDriver Following remote engines Could not be configured:[slave1] -
3、Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateK
意思是无法在根节点 Software\JavaSoft\Prefs 创建命令,实际上就是当前不是管理员权限在运行,需要管理员权限运行。
解决方法:
命令行窗口输入 regedit,打开注册表编辑器,如果 HKEY_LOCAL_MACHINE\Software\JavaSoft\Prefs 不存在,新建并赋予权限(完全控制)。如果 HKEY_LOCAL_MACHINE\Software\JavaSoft\Prefs 存在,直接赋予最高权限(完全控制)。
至此,Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002 警告消失。
main ERROR Unable to invoke factory method in class org.apache.logging.log4j.core.appender.FileAppender for element File: java.lang.IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.FileAppender java.lang.IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.FileAppender
- 4、C:\Users\gavin>jmeter -n -t D:\VIP\性能\jmeter\dushi.jmx -R slave1:1099,slave128:1099 -l report.jtl -e -o D:\VIP\性能\jmeter\result
Creating summariser
Created the tree successfully using D:\VIP\性能\jmeter\dushi.jmx
Configuring remote engine: slave1:1099
Exception creating connection to: slave1; nested exception is:
java.io.FileNotFoundException: rmi_keystore.jks (系统找不到指定的文件。)
Failed to configure slave1:1099
Configuring remote engine: slave128:1099
Exception creating connection to: slave128; nested exception is:
java.io.FileNotFoundException: rmi_keystore.jks (系统找不到指定的文件。)
Failed to configure slave128:1099
Stopping remote engines
Remote engines have been stopped
Error in NonGUIDriver java.lang.RuntimeException: Following remote engines Could not be configured:[slave1:1099, slave128:1099]
An error occurred: Error in NonGUIDriver Following remote engines Could not be configured:[slave1:1099, slave128:1099]
errorlevel=1
请按任意键继续. . .
解决方法:
在目录\apache-jmeter-5.1.1\bin下,打开名为jmeter.properties的文件
找到server.rmi.ssl.disable=false,改为true,并把前面的#去掉
上面方法还是不能解决的情况下
需要生成rmi_keystore.jks,同时需要把这个文件拷贝到各个执行的jmeter的bin目录下面,非常重要
在jmeter的bin目录下面启动cmd命令
如果还是解决不了,需要开放端口:
执行机开发三个默认端口:
server_port=1099
server.rmi.port=1099
server.rmi.localport=1099
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。