JMeter:Linux 环境中的分布式(远程)测试
JMeter: Distributed (Remote) Testing in Linux Environment
我使用 JMeter 设置了分布式负载测试环境。我正在使用 三台 Linux 机器 (RedHat)(IPs:xxx.xxx.xxx.121
,xxx.xxx.xxx.122
,xxx.xxx.xxx.123
) 使用 Secured Shell 来自我的 Windows 8.1.
我已经满足执行分布式测试的先决条件:
- 所有机器(客户端和从属)都在同一个子网中。
- 所有机器的防火墙都被禁用。
- JMeter(2.13) 和 JDk 版本(1.6.0_25) 对所有版本都相同。
Client(Master) Machine :xxx.xxx.xxx.123
Server(Slave) Machines: xxx.xxx.xxx.122,xxx.xxx.xxx.121
我做了以下事情:
1) 将以下内容添加到客户端(master)jmeter.properties 文件:
remote_hosts= xxx.xxx.xxx.122,xxx.xxx.xxx.121
2) 将以下内容添加到服务器(在每个从机中)jmeter-server:
RMI_HOST_DEF=-Djava.rmi.server.hostname=xxx.xxx.xxx.123
(客户端机器 IP)
3)然后从那两台Slave机器上启动了jmeter-server(xxx.xxx.xxx.122 ,xxx.xxx.xxx.121) 使用此命令
./jmeter-server
并获得以下输出。这意味着从机已启动。
xxx.xxx.xxx.121 的输出:
Created remote object: UnicastServerRef [liveRef: [endpoint:[xxx.xxx.xxx.123:41864](local),objID:[1707296d:154c281318b:-7fff, -8101068266055605468]]]
xxx.xxx.xxx.122 的输出:
Using local port: 4000
Created remote object: UnicastServerRef [liveRef: [endpoint:[xxx.xxx.xxx.123:4000](local),objID:[-2a2acf13:154c285ffa2:-7fff, 2939294752655639469]]]
现在我运行来自客户端机器(xxx.xxx.xxx.123)的以下命令开始远程测试.
./jmeter -n -t RemoteTest.jmx -r
它为我提供了以下输出:
Creating summariser <summary>
Created the tree successfully using RemoteTest.jmx
Configuring remote engine: xxx.xxx.xxx.121
Configuring remote engine: xxx.xxx.xxx.122
Starting remote engines
Starting the test @ Wed May 18 06:27:52 GMT 2016 (1463552872376)
Error in rconfigure() method java.rmi.ConnectException: Connection refused to host: xxx.xxx.xxx.123; nested exception is:
java.net.ConnectException: Connection refused
Error in rconfigure() method java.rmi.ConnectException: Connection refused to host: xxx.xxx.xxx.123; nested exception is:
java.net.ConnectException: Connection refused
Remote engines have been started
jmeter.log 文件的输出 (xxx.xxx.xxx.123)
2016/05/18 06:52:22 INFO - jmeter.util.JMeterUtils: Setting Locale to en_GB
2016/05/18 06:52:22 INFO - jmeter.JMeter: Loading user properties from: /usr/apache-jmeter-2.13/bin/user.properties
2016/05/18 06:52:22 INFO - jmeter.JMeter: Loading system properties from: /usr/apache-jmeter-2.13/bin/system.properties
2016/05/18 06:52:22 INFO - jmeter.JMeter: Copyright (c) 1998-2015 The Apache Software Foundation
2016/05/18 06:52:22 INFO - jmeter.JMeter: Version 2.13 r1665067
2016/05/18 06:52:22 INFO - jmeter.JMeter: java.version=1.6.0_25
2016/05/18 06:52:22 INFO - jmeter.JMeter: java.vm.name=Java HotSpot(TM) 64-Bit Server VM
2016/05/18 06:52:22 INFO - jmeter.JMeter: os.name=Linux
2016/05/18 06:52:22 INFO - jmeter.JMeter: os.arch=amd64
2016/05/18 06:52:22 INFO - jmeter.JMeter: os.version=2.6.32-358.el6.x86_64
2016/05/18 06:52:22 INFO - jmeter.JMeter: file.encoding=UTF-8
2016/05/18 06:52:22 INFO - jmeter.JMeter: Default Locale=English (United Kingdom)
2016/05/18 06:52:22 INFO - jmeter.JMeter: JMeter Locale=English (United Kingdom)
2016/05/18 06:52:22 INFO - jmeter.JMeter: JMeterHome=/usr/apache-jmeter-2.13
2016/05/18 06:52:22 INFO - jmeter.JMeter: user.dir =/usr/apache-jmeter-2.13/bin
2016/05/18 06:52:22 INFO - jmeter.JMeter: PWD =/usr/apache-jmeter-2.13/bin
2016/05/18 06:52:22 INFO - jmeter.JMeter: IP: 127.0.0.1 Name: Switch018 FullName: localhost.localdomain
2016/05/18 06:52:22 INFO - jmeter.services.FileServer: Default base='/usr/apache-jmeter-2.13/bin'
2016/05/18 06:52:22 INFO - jmeter.services.FileServer: Set new base='/usr/apache-jmeter-2.13/bin'
2016/05/18 06:52:22 INFO - jmeter.save.SaveService: Testplan (JMX) version: 2.2. Testlog (JTL) version: 2.2
2016/05/18 06:52:22 INFO - jmeter.save.SaveService: Using SaveService properties file encoding UTF-8
2016/05/18 06:52:22 INFO - jmeter.save.SaveService: Using SaveService properties file version 1656252
2016/05/18 06:52:22 INFO - jmeter.save.SaveService: Using SaveService properties version 2.8
2016/05/18 06:52:22 INFO - jmeter.save.SaveService: All converter versions present and correct
2016/05/18 06:52:22 INFO - jmeter.save.SaveService: Loading file: RemoteTest.jmx
2016/05/18 06:52:22 INFO - jmeter.protocol.http.control.CookieManager: Settings: Delete null: true Check: true Allow variable: true Save: false Prefix: COOKIE_
2016/05/18 06:52:22 INFO - jmeter.protocol.http.sampler.HTTPSamplerBase: Cannot find .className property for htmlParser, using default
2016/05/18 06:52:22 INFO - jmeter.protocol.http.sampler.HTTPSamplerBase: Parser for text/html is
2016/05/18 06:52:22 INFO - jmeter.protocol.http.sampler.HTTPSamplerBase: Parser for application/xhtml+xml is
2016/05/18 06:52:22 INFO - jmeter.protocol.http.sampler.HTTPSamplerBase: Parser for application/xml is
2016/05/18 06:52:22 INFO - jmeter.protocol.http.sampler.HTTPSamplerBase: Parser for text/xml is
2016/05/18 06:52:22 INFO - jmeter.protocol.http.sampler.HTTPSamplerBase: Parser for text/vnd.wap.wml is org.apache.jmeter.protocol.http.parser.RegexpHTMLParser
2016/05/18 06:52:23 INFO - jmeter.JMeter: Creating summariser <summary>
2016/05/18 06:52:23 INFO - jmeter.engine.DistributedRunner: Configuring remote engine: xxx.xxx.xxx.121
2016/05/18 06:52:23 INFO - jmeter.engine.DistributedRunner: Configuring remote engine: xxx.xxx.xxx.122
2016/05/18 06:52:23 INFO - jmeter.engine.DistributedRunner: Starting remote engines
2016/05/18 06:52:23 INFO - jmeter.engine.DistributedRunner: Starting the test @ Wed May 18 06:52:23 GMT 2016 (1463554343104)
2016/05/18 06:52:23 INFO - jmeter.engine.ClientJMeterEngine: running clientengine run method
2016/05/18 06:52:23 INFO - jmeter.engine.util.CompoundVariable: Note: Function class names must contain the string: '.functions.'
2016/05/18 06:52:23 INFO - jmeter.engine.util.CompoundVariable: Note: Function class names must not contain the string: '.gui.'
2016/05/18 06:52:23 INFO - jmeter.samplers.SampleEvent: List of sample_variables: []
2016/05/18 06:52:23 INFO - jmeter.samplers.BatchSampleSender: Using batching (client settings) for this run. Thresholds: num=100, time=60000
2016/05/18 06:52:23 INFO - jmeter.samplers.DataStrippingSampleSender: Using DataStrippingSampleSender for this run
2016/05/18 06:52:23 INFO - jmeter.samplers.BatchSampleSender: Using batching (client settings) for this run. Thresholds: num=100, time=60000
2016/05/18 06:52:23 INFO - jmeter.samplers.DataStrippingSampleSender: Using DataStrippingSampleSender for this run
2016/05/18 06:52:23 ERROR - jmeter.engine.ClientJMeterEngine: Error in rconfigure() method java.rmi.ConnectException: Connection refused to host: xxx.xxx.xxx.123; nested exception is:
java.net.ConnectException: Connection refused
2016/05/18 06:52:23 INFO - jmeter.engine.ClientJMeterEngine: Interrupting RMI Reaper
2016/05/18 06:52:23 INFO - jmeter.engine.ClientJMeterEngine: running clientengine run method
2016/05/18 06:52:23 INFO - jmeter.samplers.BatchSampleSender: Using batching (client settings) for this run. Thresholds: num=100, time=60000
2016/05/18 06:52:23 INFO - jmeter.samplers.DataStrippingSampleSender: Using DataStrippingSampleSender for this run
2016/05/18 06:52:23 INFO - jmeter.samplers.BatchSampleSender: Using batching (client settings) for this run. Thresholds: num=100, time=60000
2016/05/18 06:52:23 INFO - jmeter.samplers.DataStrippingSampleSender: Using DataStrippingSampleSender for this run
2016/05/18 06:52:23 ERROR - jmeter.engine.ClientJMeterEngine: Error in rconfigure() method java.rmi.ConnectException: Connection refused to host: xxx.xxx.xxx.123; nested exception is:
java.net.ConnectException: Connection refused
2016/05/18 06:52:23 INFO - jmeter.engine.DistributedRunner: Remote engines have been started
那么克服这个异常的确切解决方案是什么。
在过去的两天里,我一直在探索 Whosebug 和 Stack Exchange 以解决类似的问题,并且已经尝试了几乎所有可能的解决方案,但仍然不能'没有去掉这个exception.Actually,我失败了!!!所以请在你的回答中具体和详细。
RMI_HOST_DEF=-Djava.rmi.server.hostname=xxx.xxx.xxx.123
应该是
RMI_HOST_DEF=-Djava.rmi.server.hostname=localhost
或
RMI_HOST_DEF=-Djava.rmi.server.hostname=<ip of jmeter server>
如果您收到此错误,也应设置此项
错误 - jmeter.engine.ClientJMeterEngine:java.rmi.ConnectException:连接被拒绝主机:127.0.0.1
编辑从服务器中的文件,设置值为:enter code here
RMI_HOST_DEF=-Djava.rmi.server.hostname=192.168.5.38
IP 地址是您的从属服务器。
要么
运行命令立即数:
./jmeter-server -Djava.rmi.server.hostname=192.168.5.38
我使用 JMeter 设置了分布式负载测试环境。我正在使用 三台 Linux 机器 (RedHat)(IPs:xxx.xxx.xxx.121
,xxx.xxx.xxx.122
,xxx.xxx.xxx.123
) 使用 Secured Shell 来自我的 Windows 8.1.
我已经满足执行分布式测试的先决条件:
- 所有机器(客户端和从属)都在同一个子网中。
- 所有机器的防火墙都被禁用。
- JMeter(2.13) 和 JDk 版本(1.6.0_25) 对所有版本都相同。
Client(Master) Machine :xxx.xxx.xxx.123
Server(Slave) Machines: xxx.xxx.xxx.122,xxx.xxx.xxx.121
我做了以下事情:
1) 将以下内容添加到客户端(master)jmeter.properties 文件:
remote_hosts= xxx.xxx.xxx.122,xxx.xxx.xxx.121
2) 将以下内容添加到服务器(在每个从机中)jmeter-server:
RMI_HOST_DEF=-Djava.rmi.server.hostname=xxx.xxx.xxx.123
(客户端机器 IP)
3)然后从那两台Slave机器上启动了jmeter-server(xxx.xxx.xxx.122 ,xxx.xxx.xxx.121) 使用此命令
./jmeter-server
并获得以下输出。这意味着从机已启动。
xxx.xxx.xxx.121 的输出:
Created remote object: UnicastServerRef [liveRef: [endpoint:[xxx.xxx.xxx.123:41864](local),objID:[1707296d:154c281318b:-7fff, -8101068266055605468]]]
xxx.xxx.xxx.122 的输出:
Using local port: 4000
Created remote object: UnicastServerRef [liveRef: [endpoint:[xxx.xxx.xxx.123:4000](local),objID:[-2a2acf13:154c285ffa2:-7fff, 2939294752655639469]]]
现在我运行来自客户端机器(xxx.xxx.xxx.123)的以下命令开始远程测试.
./jmeter -n -t RemoteTest.jmx -r
它为我提供了以下输出:
Creating summariser <summary>
Created the tree successfully using RemoteTest.jmx
Configuring remote engine: xxx.xxx.xxx.121
Configuring remote engine: xxx.xxx.xxx.122
Starting remote engines
Starting the test @ Wed May 18 06:27:52 GMT 2016 (1463552872376)
Error in rconfigure() method java.rmi.ConnectException: Connection refused to host: xxx.xxx.xxx.123; nested exception is:
java.net.ConnectException: Connection refused
Error in rconfigure() method java.rmi.ConnectException: Connection refused to host: xxx.xxx.xxx.123; nested exception is:
java.net.ConnectException: Connection refused
Remote engines have been started
jmeter.log 文件的输出 (xxx.xxx.xxx.123)
2016/05/18 06:52:22 INFO - jmeter.util.JMeterUtils: Setting Locale to en_GB
2016/05/18 06:52:22 INFO - jmeter.JMeter: Loading user properties from: /usr/apache-jmeter-2.13/bin/user.properties
2016/05/18 06:52:22 INFO - jmeter.JMeter: Loading system properties from: /usr/apache-jmeter-2.13/bin/system.properties
2016/05/18 06:52:22 INFO - jmeter.JMeter: Copyright (c) 1998-2015 The Apache Software Foundation
2016/05/18 06:52:22 INFO - jmeter.JMeter: Version 2.13 r1665067
2016/05/18 06:52:22 INFO - jmeter.JMeter: java.version=1.6.0_25
2016/05/18 06:52:22 INFO - jmeter.JMeter: java.vm.name=Java HotSpot(TM) 64-Bit Server VM
2016/05/18 06:52:22 INFO - jmeter.JMeter: os.name=Linux
2016/05/18 06:52:22 INFO - jmeter.JMeter: os.arch=amd64
2016/05/18 06:52:22 INFO - jmeter.JMeter: os.version=2.6.32-358.el6.x86_64
2016/05/18 06:52:22 INFO - jmeter.JMeter: file.encoding=UTF-8
2016/05/18 06:52:22 INFO - jmeter.JMeter: Default Locale=English (United Kingdom)
2016/05/18 06:52:22 INFO - jmeter.JMeter: JMeter Locale=English (United Kingdom)
2016/05/18 06:52:22 INFO - jmeter.JMeter: JMeterHome=/usr/apache-jmeter-2.13
2016/05/18 06:52:22 INFO - jmeter.JMeter: user.dir =/usr/apache-jmeter-2.13/bin
2016/05/18 06:52:22 INFO - jmeter.JMeter: PWD =/usr/apache-jmeter-2.13/bin
2016/05/18 06:52:22 INFO - jmeter.JMeter: IP: 127.0.0.1 Name: Switch018 FullName: localhost.localdomain
2016/05/18 06:52:22 INFO - jmeter.services.FileServer: Default base='/usr/apache-jmeter-2.13/bin'
2016/05/18 06:52:22 INFO - jmeter.services.FileServer: Set new base='/usr/apache-jmeter-2.13/bin'
2016/05/18 06:52:22 INFO - jmeter.save.SaveService: Testplan (JMX) version: 2.2. Testlog (JTL) version: 2.2
2016/05/18 06:52:22 INFO - jmeter.save.SaveService: Using SaveService properties file encoding UTF-8
2016/05/18 06:52:22 INFO - jmeter.save.SaveService: Using SaveService properties file version 1656252
2016/05/18 06:52:22 INFO - jmeter.save.SaveService: Using SaveService properties version 2.8
2016/05/18 06:52:22 INFO - jmeter.save.SaveService: All converter versions present and correct
2016/05/18 06:52:22 INFO - jmeter.save.SaveService: Loading file: RemoteTest.jmx
2016/05/18 06:52:22 INFO - jmeter.protocol.http.control.CookieManager: Settings: Delete null: true Check: true Allow variable: true Save: false Prefix: COOKIE_
2016/05/18 06:52:22 INFO - jmeter.protocol.http.sampler.HTTPSamplerBase: Cannot find .className property for htmlParser, using default
2016/05/18 06:52:22 INFO - jmeter.protocol.http.sampler.HTTPSamplerBase: Parser for text/html is
2016/05/18 06:52:22 INFO - jmeter.protocol.http.sampler.HTTPSamplerBase: Parser for application/xhtml+xml is
2016/05/18 06:52:22 INFO - jmeter.protocol.http.sampler.HTTPSamplerBase: Parser for application/xml is
2016/05/18 06:52:22 INFO - jmeter.protocol.http.sampler.HTTPSamplerBase: Parser for text/xml is
2016/05/18 06:52:22 INFO - jmeter.protocol.http.sampler.HTTPSamplerBase: Parser for text/vnd.wap.wml is org.apache.jmeter.protocol.http.parser.RegexpHTMLParser
2016/05/18 06:52:23 INFO - jmeter.JMeter: Creating summariser <summary>
2016/05/18 06:52:23 INFO - jmeter.engine.DistributedRunner: Configuring remote engine: xxx.xxx.xxx.121
2016/05/18 06:52:23 INFO - jmeter.engine.DistributedRunner: Configuring remote engine: xxx.xxx.xxx.122
2016/05/18 06:52:23 INFO - jmeter.engine.DistributedRunner: Starting remote engines
2016/05/18 06:52:23 INFO - jmeter.engine.DistributedRunner: Starting the test @ Wed May 18 06:52:23 GMT 2016 (1463554343104)
2016/05/18 06:52:23 INFO - jmeter.engine.ClientJMeterEngine: running clientengine run method
2016/05/18 06:52:23 INFO - jmeter.engine.util.CompoundVariable: Note: Function class names must contain the string: '.functions.'
2016/05/18 06:52:23 INFO - jmeter.engine.util.CompoundVariable: Note: Function class names must not contain the string: '.gui.'
2016/05/18 06:52:23 INFO - jmeter.samplers.SampleEvent: List of sample_variables: []
2016/05/18 06:52:23 INFO - jmeter.samplers.BatchSampleSender: Using batching (client settings) for this run. Thresholds: num=100, time=60000
2016/05/18 06:52:23 INFO - jmeter.samplers.DataStrippingSampleSender: Using DataStrippingSampleSender for this run
2016/05/18 06:52:23 INFO - jmeter.samplers.BatchSampleSender: Using batching (client settings) for this run. Thresholds: num=100, time=60000
2016/05/18 06:52:23 INFO - jmeter.samplers.DataStrippingSampleSender: Using DataStrippingSampleSender for this run
2016/05/18 06:52:23 ERROR - jmeter.engine.ClientJMeterEngine: Error in rconfigure() method java.rmi.ConnectException: Connection refused to host: xxx.xxx.xxx.123; nested exception is:
java.net.ConnectException: Connection refused
2016/05/18 06:52:23 INFO - jmeter.engine.ClientJMeterEngine: Interrupting RMI Reaper
2016/05/18 06:52:23 INFO - jmeter.engine.ClientJMeterEngine: running clientengine run method
2016/05/18 06:52:23 INFO - jmeter.samplers.BatchSampleSender: Using batching (client settings) for this run. Thresholds: num=100, time=60000
2016/05/18 06:52:23 INFO - jmeter.samplers.DataStrippingSampleSender: Using DataStrippingSampleSender for this run
2016/05/18 06:52:23 INFO - jmeter.samplers.BatchSampleSender: Using batching (client settings) for this run. Thresholds: num=100, time=60000
2016/05/18 06:52:23 INFO - jmeter.samplers.DataStrippingSampleSender: Using DataStrippingSampleSender for this run
2016/05/18 06:52:23 ERROR - jmeter.engine.ClientJMeterEngine: Error in rconfigure() method java.rmi.ConnectException: Connection refused to host: xxx.xxx.xxx.123; nested exception is:
java.net.ConnectException: Connection refused
2016/05/18 06:52:23 INFO - jmeter.engine.DistributedRunner: Remote engines have been started
那么克服这个异常的确切解决方案是什么。 在过去的两天里,我一直在探索 Whosebug 和 Stack Exchange 以解决类似的问题,并且已经尝试了几乎所有可能的解决方案,但仍然不能'没有去掉这个exception.Actually,我失败了!!!所以请在你的回答中具体和详细。
RMI_HOST_DEF=-Djava.rmi.server.hostname=xxx.xxx.xxx.123
应该是
RMI_HOST_DEF=-Djava.rmi.server.hostname=localhost
或
RMI_HOST_DEF=-Djava.rmi.server.hostname=<ip of jmeter server>
如果您收到此错误,也应设置此项
错误 - jmeter.engine.ClientJMeterEngine:java.rmi.ConnectException:连接被拒绝主机:127.0.0.1
编辑从服务器中的文件,设置值为:enter code here
RMI_HOST_DEF=-Djava.rmi.server.hostname=192.168.5.38
IP 地址是您的从属服务器。
要么
运行命令立即数:
./jmeter-server -Djava.rmi.server.hostname=192.168.5.38