D:\software\apache-jmeter-3.3\bin>jmeter -n -t crm.jmx
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/software/apache-jmeter-3.3/lib/log4j-slf4j-impl-2.8.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/software/apache-jmeter-3.3/lib/ext/jmeter-plugins-dubbo-1.3.6-jar-with-dependencies.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/software/apache-jmeter-3.3/lib/ext/jmeter-test.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Creating summariser
Created the tree successfully using crm.jmx
Starting the test @ Tue Jan 14 15:14:48 CST 2020 (1578986088425)
Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445
summary = 4 in 00:00:01 = 7.1/s Avg: 112 Min: 2 Max: 363 Err: 0 (0.00%)
Tidying up ... @ Tue Jan 14 15:14:49 CST 2020 (1578986089355)
... end of run
D:\software\apache-jmeter-3.3\bin>jmeter -n -t crm.jmx -l test.jtl
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/software/apache-jmeter-3.3/lib/log4j-slf4j-impl-2.8.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/software/apache-jmeter-3.3/lib/ext/jmeter-plugins-dubbo-1.3.6-jar-with-dependencies.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/software/apache-jmeter-3.3/lib/ext/jmeter-test.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Creating summariser
Created the tree successfully using crm.jmx
Starting the test @ Tue Jan 14 15:18:49 CST 2020 (1578986329264)
Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445
summary = 4 in 00:00:00 = 8.2/s Avg: 96 Min: 0 Max: 342 Err: 0 (0.00%)
Tidying up ... @ Tue Jan 14 15:18:50 CST 2020 (1578986330127)
将test.jtl导入到jmeterGUI中可看到
D:\software\apache-jmeter-3.3\bin>jmeter -n -t crm.jmx -l test.jtl -e -o web
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/software/apache-jmeter-3.3/lib/log4j-slf4j-impl-2.8.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/software/apache-jmeter-3.3/lib/ext/jmeter-plugins-dubbo-1.3.6-jar-with-dependencies.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/software/apache-jmeter-3.3/lib/ext/jmeter-test.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Creating summariser
Created the tree successfully using crm.jmx
Starting the test @ Tue Jan 14 15:23:21 CST 2020 (1578986601678)
Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445
summary = 4 in 00:00:00 = 8.2/s Avg: 95 Min: 1 Max: 340 Err: 0 (0.00%)
Tidying up ... @ Tue Jan 14 15:23:22 CST 2020 (1578986602521)
注意:web为测试报告所导出的目录,该目录必须为空文件夹
测试报告如下:
D:\software\apache-jmeter-3.3\bin>jmeter -n -t crm.jmx -r
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/software/apache-jmeter-3.3/lib/log4j-slf4j-impl-2.8.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/software/apache-jmeter-3.3/lib/ext/jmeter-plugins-dubbo-1.3.6-jar-with-dependencies.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/software/apache-jmeter-3.3/lib/ext/jmeter-test.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Creating summariser
Created the tree successfully using crm.jmx
Configuring remote engine: 127.0.0.1
Using remote object: UnicastRef [liveRef: [endpoint:[192.168.3.199:63025](remote),objID:[4e831b4d:16f8d44d876:-7fff, -7041486427723727807]]]
Configuring remote engine: 192.168.3.161
Connection refused to host: 192.168.3.161; nested exception is:
java.net.ConnectException: Connection refused: connect
Failed to configure 192.168.3.161
注意:3.161上面的jmeter服务没有启动,所以报错了
将171上面的jmeter启动
[root@DataNode0 bin]# jmeter-server
Created remote object: UnicastServerRef [liveRef: [endpoint:[192.168.3.171:16746](local),objID:[-3183922:16fa2f8e18e:-7fff, -875491763938485046]]]
随后在主服务器上执行命令:
D:\software\apache-jmeter-3.3\bin>jmeter -n -t crm.jmx -R 192.168.3.171:1099
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/software/apache-jmeter-3.3/lib/log4j-slf4j-impl-2.8.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/software/apache-jmeter-3.3/lib/ext/jmeter-plugins-dubbo-1.3.6-jar-with-dependencies.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/software/apache-jmeter-3.3/lib/ext/jmeter-test.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Creating summariser
Created the tree successfully using crm.jmx
Configuring remote engine: 192.168.3.171:1099
Using remote object: UnicastRef [liveRef: [endpoint:[192.168.3.171:16746](remote),objID:[-3183922:16fa2f8e18e:-7fff, -875491763938485046]]]
Starting remote engines
Starting the test @ Tue Jan 14 15:33:46 CST 2020 (1578987226562)
Remote engines have been started
Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445
summary = 4 in 00:00:01 = 3.4/s Avg: 232 Min: 0 Max: 470 Err: 1 (25.00%)
Tidying up remote @ Tue Jan 14 15:33:56 CST 2020 (1578987236730)
此时从服务器上
**Jan 14, 2020 3:33:57 PM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
Starting the test on host 192.168.3.171:1099 @ Tue Jan 14 15:33:57 CST 2020 (1578987237972)
Finished the test on host 192.168.3.171:1099 @ Tue Jan 14 15:33:59 CST 2020 (1578987239645)
**
至此,远程执行成功。
可能出现的问题
从服务器没有启动,1099端口占用:
使用lsof -i:1099查看是否端口被占用,若存在则kill -9 “进程号”杀掉进程,然后使用jmeter-server重启一下即可
使用命令执行时,有时候需要抓包查看脚本是否正确。这时候就需要使用代理了。代理工具可使用fiddler
D:\software\apache-jmeter-3.3\bin>jmeter -n -t crm.jmx -H 127.0.0.1 -P 8888
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/software/apache-jmeter-3.3/lib/log4j-slf4j-impl-2.8.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/software/apache-jmeter-3.3/lib/ext/jmeter-plugins-dubbo-1.3.6-jar-with-dependencies.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/software/apache-jmeter-3.3/lib/ext/jmeter-test.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Creating summariser
Created the tree successfully using crm.jmx
Starting the test @ Tue Jan 14 15:43:29 CST 2020 (1578987809414)
Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445
summary + 1 in 00:00:00 = 2.3/s Avg: 333 Min: 333 Max: 333 Err: 0 (0.00%) Active: 1 Started: 1 Finished: 0
summary + 3 in 00:00:00 = 76.9/s Avg: 6 Min: 1 Max: 13 Err: 0 (0.00%) Active: 0 Started: 2 Finished: 2
summary = 4 in 00:00:00 = 8.4/s Avg: 88 Min: 1 Max: 333 Err: 0 (0.00%)
Tidying up ... @ Tue Jan 14 15:43:30 CST 2020 (1578987810271)
... end of run