JMeter 官方解读:http://jmeter.apache.org/usermanual/jmeter_distributed_testing_step_by_step.pdf
**********************
Step-by-Step
1. On the slave systems, go to jmeter/bin directory and execute jmeter-server.bat (jmeter-server on
unix).
On windows, you should see a dos window appear with “jre\[version]\bin\rmiregistry.exe”.
If this doesn't happen, it means either the environment settings are not right, or there are
multiple JRE installed on the system. Note: [version] would be the jre version installed on the
system.
1. Open jmeter-server.bat in a text editor
2. go to line 44 and find “:setCP”
3. edit “START rmiregistry” to the full path. Example: “START C:\<JAVA_HOME>\jre\bin\rmiregistry”
2. On master system acting as the console, open windows explorer and go to jmeter/bin directory
3. open jmeter.properties in a text editor
4. edit the line “remote_hosts=127.0.0.1”
5. add the IP address. For example, if I have jmeter server running on 192.168.0.10, 11, 12, 13, and
14, the entry would like like this:
remote_hosts=192.168.0.10,192.168.0.11,192.168.0.12,192.168.0.13,192.168.0.14
6. Start jmeter.
7. Open the test plan you want to use
**************************
Jmeter - Linux 下面执行jmeter-server的时候出现:An error occurred: Cannot start. localhost is a loopback address.错误
[root@localhost bin]# ./jmeter-server
Created remote object: UnicastServerRef [liveRef: [endpoint:[127.0.0.1:39150](local),objID:[-3126fe29:14300b1102e:-7fff, -4078314045196249121]]]Server failed to start: java.rmi.RemoteException: Cannot start. localhost is a loopback address.
An error occurred: Cannot start. localhost is a loopback address.
解决方法如下: In latest version, you can run your script with:指定本地IP
./jmeter-server -Djava.rmi.server.hostname=xxx.xxx.xxx.xxx
[root@localhost bin]# ./jmeter-server -Djava.rmi.server.hostname=192.168.237.129
Created remote object: UnicastServerRef [liveRef: [endpoint:[192.168.237.129:47673](local),objID:[-7946c75b:14300b3330a:-7fff, -616947588795269019]]]
这样就可以在 本地的Master里面看到远程启动了:
******************************************************************************************
Linux下面用nohup命令**** + &,后台执行,启用server
***********************************************************************************
[root@localhost bin]# nohup ./jmeter-server -Djava.rmi.server.hostname=192.168.237.129 &
[1] 11124[root@localhost bin]# nohup: appending output to “nohup.out”
***********************************************************************************
下面命令查看 jmeter,确定jmeter启动成功~~
***********************************************************************************
[root@localhost bin]# ps axu | grep jmeterroot 11124 0.0 0.1 4820 1036 pts/1 S 21:20 0:00 /bin/sh ./jmeter-server -Djava.rmi.server.hostname=192.168.237.129
root 11126 0.0 0.0 4820 1028 pts/1 S 21:20 0:00 /bin/sh ./jmeter -Dserver_port=1099 -s -j jmeter-server.log -Djava.rmi.server.hostname=192.168.237.129
root 11128 6.6 2.7 741152 28260 pts/1 Sl 21:20 0:00 java -server -XX:+HeapDumpOnOutOfMemoryError -Xms512m -Xmx512m -XX:NewSize=128m -XX:MaxNewSize=128m -XX:MaxTenuringThreshold=2 -XX:PermSize=64m -XX:MaxPermSize=128m -XX:+CMSClassUnloadingEnabled -jar ./ApacheJMeter.jar -Dserver_port=1099 -s -j jmeter-server.log -Djava.rmi.server.hostname=192.168.237.129
root 11149 0.0 0.0 4260 680 pts/1 R+ 21:21 0:00 grep jmeter