Remote Testing Jmeter - Not able to View Result - Error:System property 'java.rmi.server.hostname' is not defined

Remote Testing Jmeter - Not able to View Result - Error:System property 'java.rmi.server.hostname' is not defined

我目前正在使用 Jmeter v5.2 进行远程测试并尝试连接到从服务器。遵循 Jmeter 用户手册中的所有步骤。最后,我无法在我的主机中看到结果,并且出现以下错误。

System property 'java.rmi.server.hostname' is not defined, using localHost address

我相信我已经越过检查我这边是否有任何错误,比如

  1. 在同一版本的 Jmeter 上 运行 和 Windows
  2. 确保端口上没有任何监听

但还没有运气。有什么我想念的吗?同样在服务器端(从)我收到如下消息。

看起来连接成功了。但是我没有看到任何结果。
以下是 jmeter 日志

    Configuring remote engine: slave_ipaddrss
2019-11-18 09:21:16,108 INFO o.a.j.e.DistributedRunner: Starting distributed test with remote engines: [slave_ipaddrss] @ Mon Nov 18 09:21:16 EST 2019 (1574086876108)
2019-11-18 09:21:16,109 INFO o.a.j.e.ClientJMeterEngine: running clientengine run method
2019-11-18 09:21:16,109 INFO o.a.j.r.RmiUtils: System property 'java.rmi.server.hostname' is not defined, using localHost address
2019-11-18 09:21:16,109 INFO o.a.j.r.RmiUtils: Local IP address=local_ipaddrss
2019-11-18 09:21:16,114 INFO o.a.j.r.SSLRMIServerSocketFactory: Created SSLSocket: [SSL: ServerSocket[addr=localhostname/local_ipaddrss,localport=8152]]
2019-11-18 09:21:16,114 INFO o.a.j.s.BatchSampleSender: Using batching (client settings) for this run. Thresholds: num=100, time=60000
2019-11-18 09:21:16,114 INFO o.a.j.s.DataStrippingSampleSender: Using DataStrippingSampleSender for this run
2019-11-18 09:21:16,115 INFO o.a.j.r.RmiUtils: System property 'java.rmi.server.hostname' is not defined, using localHost address
2019-11-18 09:21:16,115 INFO o.a.j.r.RmiUtils: Local IP address=local_ipaddrss
2019-11-18 09:21:16,120 INFO o.a.j.r.SSLRMIServerSocketFactory: Created SSLSocket: [SSL: ServerSocket[addr=localhostname/local_ipaddrss,localport=8153]]
2019-11-18 09:21:16,121 INFO o.a.j.s.BatchSampleSender: Using batching (client settings) for this run. Thresholds: num=100, time=60000
2019-11-18 09:21:16,121 INFO o.a.j.s.DataStrippingSampleSender: Using DataStrippingSampleSender for this run
2019-11-18 09:21:16,121 INFO o.a.j.r.RmiUtils: System property 'java.rmi.server.hostname' is not defined, using localHost address
2019-11-18 09:21:16,121 INFO o.a.j.r.RmiUtils: Local IP address=local_ipaddrss
2019-11-18 09:21:16,126 INFO o.a.j.r.SSLRMIServerSocketFactory: Created SSLSocket: [SSL: ServerSocket[addr=localhostname/local_ipaddrss,localport=8154]]
2019-11-18 09:21:16,128 INFO o.a.j.r.RmiUtils: System property 'java.rmi.server.hostname' is not defined, using localHost address
2019-11-18 09:21:16,128 INFO o.a.j.r.RmiUtils: Local IP address=local_ipaddrss
2019-11-18 09:21:16,133 INFO o.a.j.r.SSLRMIServerSocketFactory: Created SSLSocket: [SSL: ServerSocket[addr=localhostname/local_ipaddrss,localport=8155]]
2019-11-18 09:21:16,408 INFO o.a.j.e.ClientJMeterEngine: sent test to slave_ipaddrss basedir='.'
2019-11-18 09:21:16,409 INFO o.a.j.e.ClientJMeterEngine: Sending properties {}
2019-11-18 09:21:16,414 INFO o.a.j.e.ClientJMeterEngine: sent run command to slave_ipaddrss
2019-11-18 09:21:16,414 INFO o.a.j.e.DistributedRunner: Remote engines have been started:[slave_ipaddrss]
2019-11-18 09:21:16,696 INFO o.a.j.g.u.JMeterMenuBar: setRunning(true, slave_ipaddrss)
2019-11-18 09:21:17,443 INFO o.a.j.g.u.JMeterMenuBar: setRunning(false, slave_ipaddrss)

谢谢。

首先检查 JMeter 从机上的 jmeter-server.log 文件,如果出现故障,它应该包含足够的故障排除信息,以便您能够找到问题的根源。

其次,查看 jmeter-server file there is a stanza 看起来像:

# If the client fails with:
# ERROR - jmeter.engine.ClientJMeterEngine: java.rmi.ConnectException: Connection refused to host: 127.0.0.1
# then it may be due to the server host returning 127.0.0.1 as its address 

# One way to fix this is to define RMI_HOST_DEF below
#RMI_HOST_DEF=-Djava.rmi.server.hostname=xxx.xxx.xxx.xxx

因此您可以尝试在 JMeter 从站端显式设置 RMI server hostname,例如:

jmeter-server.bat -Djava.rmi.server.hostname=10.20.30.40

完成后,您可以像这样启动 JMeter master:

jmeter -R10.20.30.40

10.20.30.40替换为你的JMeter从机的实际IP地址。

更多信息:

我已经通过增加重试次数解决了这个问题,默认情况下是1次。当分布式测试开始时,可​​能会尝试多次初始化远程引擎
您可以在 jmeter.properties 文件中找到并编辑 "client.tries" 并取消注释为

client.tries= 3

我还使用下面的命令在从机中启动 jmeter 服务器。

jmeter-server.bat -Djava.rmi.server.hostname=local ipaddress

这帮助我将 rmi 服务器主机名明确定义为本地地址。