做时间的朋友😭
Linux压测环境搭建(Jmeter)及压测

环境:Centos7
Jmeter: Apache JMeter - Download Apache JMeter
JDK:在线安装 yum install jdk

一.安装JDK

1.yum search java|grep jdk #下载jdk
2.yum install -y java-1.8.0-openjdk*
3.java -version javac #查看是否安装成功

[root@localhost ]# which java  
/usr/bin/java  
[root@localhost ]# ls -lr /usr/bin/java  
lrwxrwxrwx. 1 root root 22 6月 29 10:30 /usr/bin/java -> /etc/alternatives/java  
[root@localhost ]# ls -lr /etc/alternatives/java  
lrwxrwxrwx. 1 root root 73 6月 29 10:30 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/jre/bin/java

二.配置环境变量

① vi /etc/profile #打开环境编辑的文件

② 在文件最后加上这四行

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b06-1.el7_9.x86_64
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b06-1.el7_9.x86_64/jre/bin/java

③ :wq //保存并退出文件

④ source /etc/profile //使文件生效

⑤ echo $JAVA_HOME //验证是否编辑成功

三.上传Jmeter压缩包,解压

1.unzip file.zip #解压缩file.zip文件

四.压测

1.#运行jmeter脚本
/home/apache-jmeter-5.4.3/bin/jmeter.sh -n -t /jmx/jmxscript/historicTaskList.jmx -l /jmx/jmxscript/report/historicTaskList2000.jtl -JthreadCount=2000 -JrampUp=2 -JkeepTime=300

2.#将测试结果.jtl文件转换为html
/home/apache-jmeter-5.4.3/bin/jmeter.sh -g /jmx/jmxscript/report/historicTaskList2000.jtl -e -o /jmx/jmxscript/report/historicTaskList2000

3.#将文件夹压缩 把xx路径下的historicTaskList2000文件夹压缩后放到xx路径

zip -q -r /jmx/jmxscript/report/result/historicTaskList2000.zip /jmx/jmxscript/report/historicTaskList2000/
jmeter linux
软件测试面试题目
© 2022 Sk8erBoi
Powered by hexo | Theme is blank