Foreword
Use jmeter do when the pressure measured in the windows is not very stable, has been using all jmeter on linux server to do the stress test.
Jmeter built environment, and run scripts on linux jmeter under Benpian record, view the report.
Related environmental:
the Java 1.8
jmeter 5.1.1
java environment
Install java environment on Linux, install version 1.8.0, first find a list of related java
yum -y list java*
[root@VM_0_2_centos ~]# yum -y list java*
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors
Available Packages
java-1.6.0-openjdk.x86_64 1:1.6.0.41-1.13.13.1.el7_3 os
java-1.6.0-openjdk-demo.x86_64 1:1.6.0.41-1.13.13.1.el7_3 os
...
java-1.7.0-openjdk.x86_64 1:1.7.0.231-2.6.19.2.el7_7 updates
java-1.7.0-openjdk-accessibility.x86_64 1:1.7.0.231-2.6.19.2.el7_7 updates
...
java-1.8.0-openjdk.i686 1:1.8.0.222.b10-1.el7_7 updates
java-1.8.0-openjdk.x86_64 1:1.8.0.222.b10-1.el7_7 updates
...
Install java-1.8.0-openjdk-related documents
yum -y install java-1.8.0-openjdk*
After the installation is complete, the environment variable automatic was already in effect, enter java -version to see the version number
java -version
[root@VM_0_2_centos ~]# java -version
openjdk version "1.8.0_232"
OpenJDK Runtime Environment (build 1.8.0_232-b09)
OpenJDK 64-Bit Server VM (build 25.232-b09, mixed mode)
[root@VM_0_2_centos ~]#
Installation jmeter
In jmeter official website https://jmeter.apache.org/ download jmeter the zip installation package, the download is complete spread to any directory on linux, for example, I was / root / jmeter.
Using the unzip command to extract the zip file, if at first yum install unzip had not been installed,
yum -y install unzip
[root@VM_0_2_centos ~]# mkdir jmeter
[root@VM_0_2_centos ~]# cd jmeter/
[root@VM_0_2_centos jmeter]# pwd
/root/jmeter
[root@VM_0_2_centos jmeter]# yum -y install unzip
[root@VM_0_2_centos jmeter]# ll
total 58292
-rw-r--r-- 1 root root 59684716 Oct 31 22:16 apache-jmeter-5.1.1.zip
[root@VM_0_2_centos jmeter]# unzip apache-jmeter-5.1.1.zip
Use unzip unzip the .zip file
unzip apache-jmeter-5.1.1.zip
After the extraction is completed, the next editor vi / etc / profile file, set the environment variable, edit the file at the bottom
export PATH=/root/jmeter/apache-jmeter-5.1.1/bin/:$PATH
The next source implementation of / etc / profile file so that the environment variables to take effect
source /etc/profile
Enter jmeter -v can see the contents of the installation was successful
JMeter -v
[root@VM_0_2_centos jmeter]# cd apache-jmeter-5.1.1/
[root@VM_0_2_centos apache-jmeter-5.1.1]# cd bin
[root@VM_0_2_centos bin]# pwd
/root/jmeter/apache-jmeter-5.1.1/bin
[root@VM_0_2_centos bin]# vi /etc/profile
# 底部编辑export PATH=/root/jmeter/apache-jmeter-5.1.1/bin/:$PATH
[root@VM_0_2_centos bin]# source /etc/profile
[root@VM_0_2_centos bin]# jmeter -v
Oct 31, 2019 10:24:25 PM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
_ ____ _ ____ _ _ _____ _ __ __ _____ _____ _____ ____
/ \ | _ \ / \ / ___| | | | ____| | | \/ | ____|_ _| ____| _ \
/ _ \ | |_) / _ \| | | |_| | _| _ | | |\/| | _| | | | _| | |_) |
/ ___ \| __/ ___ \ |___| _ | |___ | |_| | | | | |___ | | | |___| _ <
/_/ \_\_| /_/ \_\____|_| |_|_____| \___/|_| |_|_____| |_| |_____|_| \_\ 5.1.1 r1855137
Copyright (c) 1999-2019 The Apache Software Foundation
[root@VM_0_2_centos bin]#
Start test script jmeter
First, ensure your local computer script debugging, and save the test plans Test Plan.jmx
Script files (Test Plan.jmx) on import linux server, execute the following command to start the test plan
jmeter -n -t Test Plan.jmx -l testplan.jtl
Parameter Description:
- -n run as a no gui way to test plan
- -t indicates that the test plan, test plan followed by the name, there are spaces as saying by \ space
- -l indicates that the test results, test results followed by file name, file extension is .jtl
View report file
After the test testplan.jtl export file, see the results running on the local jmeter