查看linux系统信息是64位的
jdk-8u251-linux-x64.tar.gz
https://download.oracle.com/otn/java/jdk/8u251-b08/3d5a2bb8f8d4428bbe94aed7ec7ae784/jdk-8u251-linux-x64.tar.gz?AuthParam=1594705357_39d666128796b8b68a04eac282a3882f
apache-jmeter-5.3.tgz
https://mirrors.bfsu.edu.cn/apache//jmeter/binaries/apache-jmeter-5.3.tgz
useradd jmeter
passwd jmeter
su - jmeter
1】上传jdk-8u251-linux-x64.tar.gz到/opt目录
2】tar -zxvf jdk-8u251-linux-x64.tar.gz解压
3】给jdk权限
chmod -R 777 apache-jmeter-5.3/
4】配置jdk环境变量
vim ~/.bash_profile 打开文件在末尾添加下面内容,并:wq保存退出
export JAVA_HOME=/opt/jdk1.8.0_251 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin export PATH=$PATH:${JAVA_PATH}
4】使jdk配置文件生效,执行
source ~/.bash_profile
5】检查jdk是否可用,执行
java -version
可以看到jdk版本信息 echo $PATH 检查jdk目录配置是否正确
1】上传apache-jmeter-5.3.tgz到/opt目录
2】tar -zxvf apache-jmeter-5.3.tgz 解压
3】给jmeter权限【不然会jmeter.log没有权限写人报错】
chmod -R 777 apache-jmeter-5.3/
4】配置jmeter环境变量
vim ~/.bash_profile 打开文件在末尾添加下面内容,并:wq保存退出 export JMETER_HOME=/opt/apache-jmeter-5.3 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
4】使jmeter配置文件生效,执行
source ~/.bash_profile
5】验证jmeter是否可用
jmeter --version
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c0000000, 1073741824, 0) failed; error='Cannot allocate memory' (errno=12) # # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (mmap) failed to map 1073741824 bytes for committing reserved memory. # An error report file with more information is saved as: # /opt/hs_err_pid17326.log
提示内存不足,升级内存,后成功
jmeter --version _ ____ _ ____ _ _ _____ _ __ __ _____ _____ _____ ____ / \ | _ \ / \ / ___| | | | ____| | | \/ | ____|_ _| ____| _ \ / _ \ | |_) / _ \| | | |_| | _| _ | | |\/| | _| | | | _| | |_) | / ___ \| __/ ___ \ |___| _ | |___ | |_| | | | | |___ | | | |___| _ < /_/ \_\_| /_/ \_\____|_| |_|_____| \___/|_| |_|_____| |_| |_____|_| \_\ 5.3 Copyright (c) 1999-2020 The Apache Software Foundation
1、将参数化文件上传到linux服务器,放在linux上jmeter的bin路径下
注意:
1.jmeter脚本不用传到linux
2.参数化文件window和linux都放在bin路径下【和jmeter.bat同级】,路径名直接写文件名即可:xxxx.csv,这样可以解决参数文件因为在不同的平台导致找不到的问题
2、设置server.rmi.ssl.disable=true
分别修改主控机和负载机的jmeter.properties文件,修改参数server.rmi.ssl.disable=true
3、linux下启动负载机
./jmeter-server -Djava.rmi.server.hostname=XX.XX.XX.XX
执行上面命令出现下面日志就可以了: Created remote object: UnicastServerRef2 [liveRef: [endpoint:[XX.XX.XX.XX:42199](local),objID:[-336acc11:17351270199:-7fff, 7523584835356703042]]]
4、windows主控机添加负载机
打开jmeter.properties文件,查找remote_hosts=localhost:1099,添加XX.XX.XX.XX负载机IP
remote_hosts=XX.XX.XX.XX:1099
注意:端口号默认为1099
jmeter打开脚本--》运行--》远程启动--》XX.XX.XX.XX