目录
在jmeter的bin目录下创建一个setenv.bat文件,文件内容为
安装架构
本次安装的架构如下:
序号 | 角色 | 主机IP | 端口 |
1 | 图形端/主控端 | 本机windows系统 | 1099 |
2 | 压力机/服务端 | 192.168.194.166 | 1099 |
3 | 压力机/服务端 | 192.168.194.167 | 1099 |
4 | 压力机/服务端 | 192.168.194.168 | 1099 |
windows安装jmeter
-
安装JDK,版本1.8,配置jdk环境变量
-
在jmeter的bin目录下创建一个setenv.bat文件,文件内容为
这里根据自行调整内存大小,默认为1024m,做大型测试时起步4G
其它参考选项,详见官网(1.4 Running JMeter)
https://jmeter.apache.org/usermanual/get-started.html#running
rem This is the content of bin\setenv.bat,rem it will be called by bin\jmeter.bat
set JVM_ARGS=-Xms2g -Xmx2g -Dpropname=longge
-
修改 jmeter.properties 配置文件
server.rmi.ssl.disable=true
sampleresult.default.encoding=UTF-8 // 未设置的话,采样器结果有可能乱码
remote_hosts=192.168.194.166:1099,192.168.194.167:1099,192.168.194.168:1099 //分布式压测设置
linux安装jmeter
-
通过VMware虚拟机克隆3台centos服务器
-
修改静态ip地址
cd /etc/sysconfig/network-scripts/
cat ifcfg-ens33
TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=ens33 UUID=3dfbd006-f86e-4146-ad4c-a8bc25603a3b DEVICE=ens33 ONBOOT=yes IPV6_PRIVACY=no IPADDR=192.168.194.166 NETMASK=255.255.255.0 GATEWAY=192.168.194.2 DNS1=192.168.194.2 |
修改后重启一下网络服务即可 systemctl restart network
systemctl restart network
-
安全设置
关闭防火墙
[root@localhost ~]# systemctl disable firewalld
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# firewall-cmd --state
not running
# 关闭swap
swapoff -a # 临时
sed -ri 's/.*swap.*/#&/' /etc/fstab # 永久
SELinux设置为SELINUX=disabled
[root@localhost ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
修改完SELinux配置后,需要重新启动系统
reboot
-
安装centos常用的依赖
yum install vim -y
yum install gcc -y
yum install libaio -y
yum -y install net-tools
-
配置jdk和jmeter环境变量
vim /etc/profile
export JAVA_HOME=/usr/local/soft/jdk1.8.0_361
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
export JMETER_HOME=/usr/local/soft/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
-
参数修改
在 bin 目录下面增加 setenv.sh 文件
#This is the content of bin\setenv.sh,
#it will be called by bin\jmeter.sh
export JVM_ARGS="-Xms2g -Xmx2g -Dpropname=longge"
修改 jmeter.properties 配置文件
server.rmi.ssl.disable=true
sampleresult.default.encoding=UTF-8
修改 jmeter-server 文件
RMI_HOST_DEF=-Djava.rmi.server.hostname=192.168.194.166
验证
出现如图,说明配置安装成功