jmeter结合ansible分布式压测--准备工作
主要思路:用ansible去修改施压执行机的配置,执行用jmeter分布式方式。准备1个host文件s-host-suzhou20.txt 部署csv,jmter环境,jmx 到所有环境上
1、修改每台施压机的bin文件中的jmeter.properties
#server.rmi.ssl.disable=false,注释#取消,修改server.rmi.ssl.disable=true
ansible -i s-host-suzhou324-335.txt allHost -m shell -a "sed -i -e '345s/#server.rmi.ssl.disable=false/server.rmi.ssl.disable=true/' /apprun/jmeter-5.4.1/bin/jmeter.properties"
2、授权jmeter.sh可执行权限,
ansible -i s-host-suzhou324-335.txt allHost -m shell -a "cd /apprun/jmeter-5.4.1/bin && chmod +x jmeter.sh &"
3、ansible授权每台slaver服务器的 jmeter-server
ansible -i s-host-suzhou324-335.txt allHost -m shell -a "cd /apprun/jmeter-5.4.1/bin && chmod +x jmeter-server &"
备注:如果出现无权限授权整个jmeter文件夹
ansible -i s-host-suzhou324-335.txt allHost -m shell -a "cd /apprun && chmod -R 755 jmeter-5.4.1 &"
4、meter-server启动命令:ansible -i s-host-suzhou324-335.txt allHost -m shell -a "cd /apprun/jmeter-5.4.1/bin && nohup ./jmeter-server &"
5、可以分机器上查看ps -ef|grep jmeter 服务启动的情况
6、如需要清除每台机器上的进程,跳板机执行杀jmeter进程命令:
ansible -i s-host-suzhou324-335.txt allHost -m shell -a "ps aux | grep jmeter | grep -v grep | awk '{print $2}' | xargs kill -9"