环境准备:
安装jmeter,JDK:
wget https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-5.1.tgz
cd /usr/local
tar -zxvf apache-jmeter-5.1.tgz
配置环境变量:
vi /etc/profile
添加如下环境变量
#java_home
export JAVA_HOME=/usr/local/java/jdk1.8.0_221
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
#JMETER HOME
export JMETER_HOME=/usr/local/apache-jmeter-5.1
export CLASSPATH=$JMETER_HOME/lib/ext/ApacheJMeter_core.jar:$JMETER_HOME/lib/jorphan.jar:$CLASSPATH
export PATH=$JMETER_HOME/bin:$PATH:$HOME/bin
验证环境:
执行命令:注意对于24h稳定性测试由于 export TMOUT=0 对于ssh session 还是无效,会导致jmx 任务中断,所以解决此问题需要借助nohup 命令挂载到后台:
nohup jmeter -n -t fatecqtest.jmx -l 20th5min.csv -e -o 20thdir5min > 20nohup.csv 2>&1 &
ps -ef|grep jmeter | awk '{print $2}'|xargs kill -9 //结束jmeter进程
生成html报告: