jmeter分布式环境搭建
1.在代理机上启动jmeter-server.bat
2.在执行机上,机器的JMeter安装目录下找到bin目录,再找到jmeter.properties这个文件,使用记事本打开它
查找“remote_host”,
remote_hosts=127.0.0.1”其中127.0.0.1代表本机,这里需要修改成这样:
remote_hosts=127.0.0.1, 192.168.1.131:1099,192.168.254.1:1099其中1099是默认的端口号,不需要改动。192.168.1.131,192.168.1.254
这二个IP是作为远程负载机的IP,用逗号隔开
设置线程
1.先试试远程启动127.0.0.1
查看聚合报告,运行正常
再试试运行192.168.1.131,查看聚合报告运行正常。
远程全部启动,查看聚合报告,2个Sample,成功。
ERROR - jmeter.gui.action.RemoteStart: Failed to initialise remote engine java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
java.net.ConnectException: Connection refused: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
at sun.rmi.server.UnicastRef.newCall(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Unknown Source)
at org.apache.jmeter.engine.ClientJMeterEngine.getEngine(ClientJMeterEngine.java:54)
at org.apache.jmeter.engine.ClientJMeterEngine.<init>(ClientJMeterEngine.java:67)
at org.apache.jmeter.gui.action.RemoteStart.doRemoteInit(RemoteStart.java:180)
at org.apache.jmeter.gui.action.RemoteStart.doAction(RemoteStart.java:80)
at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:81)
这个问题终于被我解决了,其实原因好简单呀。只要将本机的server.bat执行即可。
注意:要是在配置的地方写了127.0.0.1 的话 就要开本机的 sever.bat. 不写的话 就不用开了
4、查看1099端口是否被占用
netstat -ano | findstr "1099"
tasklist | findstr "1099"