testing - JMeter 与远程服务器

标签 testing amazon-ec2 jmeter

我正在尝试以分布式模式设置 JMeter。 我有一个在 ec2 实例上运行的服务器,我希望主服务器在我的本地计算机上运行。 我不得不放弃让 RMI 在服务器上正常工作的一些希望,但通过将“java.rmi.server.hostname”设置为 ec2 实例的 IP 来解决。

下一个(希望也是最后一个)问题是服务器与主服务器的通信。

问题是,因为我是从内部网络执行此操作的,所以当它应该发回我的外部连接的 IP (92.XXX) 时,master 发送了它的本地/内部 IP 地址 (192.168.1.XXX) .XXX.XXX).

我可以在 jmeter-server.log 中看到这个:

ERROR - jmeter.samplers.RemoteListenerWrapper: testStarted(host) java.rmi.ConnectException: Connection refused to host: 192.168.1.50; nested exception is:

那个主机IP是错误的。它应该是 92.XXX.XXX.XX 地址。我认为这是因为在主日志中我看到以下内容:

2012/07/29 20:45:25 INFO - jmeter.JMeter: IP: 192.168.1.50 Name: XXXXXX.local FullName: 192.168.1.50

并且此 IP 在 RMI 设置期间发送到服务器。

所以我想我有两个选择:

  1. 告诉master发送外部IP
  2. 告诉服务器连接到主服务器的外部 IP。

但我看不到在哪里设置这些命令。

任何帮助都是有用的。

最佳答案

为了 future 读者的利益,请不要拒绝。有可能的!此外,您还可以保留防火墙。

在这种情况下,我在端口 4000 上执行了所有操作。

如何连接 JMeter 客户端和服务器以跨不同网络与 Amazon EC2 实例和本地开发机器进行分布式测试。

设置:

  1. JMeter 2.13 客户端:本地开发计算机(不同网络)
  2. JMeter 2.13 服务器:Amazon EC2 实例

我按如下方式配置了分布式客户端/服务器 JMeter 连接:

<强>1。在我的防火墙/路由器上添加了端口转发规则:

  • 端口:4000
  • 目标:LAN 上的 JMeter 客户端私有(private) IP 地址。

<强>2。在 EC2 实例上配置“安全组”设置:

  • 类型:允许:入站
  • 端口:4000
  • 来源:JMeter客户端公网IP地址(我的开发电脑/网络公网IP)

更新:如果您已经拥有 SSH 连接,则可以使用 SSH 隧道进行连接,这样就无需添加防火墙规则。

$ ssh -i ~/.ssh/54-179-XXX-XXX.pem ServerAliveInterval=60 -R 4000:localhost:4000 jmeter@54.179.XXX.XXX

3.配置客户端 $JMETER_HOME/bin/jmeter.properties 文件 RMI 部分:

请注意,此处仅包含我更改的非默认值:

#---------------------------------------------------------------------------
# Remote hosts and RMI configuration
#---------------------------------------------------------------------------

# Remote Hosts - comma delimited
# Add EC2 JMeter server public IP address:Port combo
remote_hosts=127.0.0.1,54.179.XXX.XXX:4000

# RMI port to be used by the server (must start rmiregistry with same port)
server_port=4000

# Parameter that controls the RMI port used by the RemoteSampleListenerImpl (The Controler)
# Default value is 0 which means port is randomly assigned
# You may need to open Firewall port on the Controller machine
client.rmi.localport=4000

# To change the default port (1099) used to access the server:
server.rmi.port=4000

# To use a specific port for the JMeter server engine, define
# the following property before starting the server:
server.rmi.localport=4000

<强>4。配置远程服务器 $JMETER_HOME/bin/jmeter.properties 文件 RMI 部分如下:

#---------------------------------------------------------------------------
# Remote hosts and RMI configuration
#---------------------------------------------------------------------------

# RMI port to be used by the server (must start rmiregistry with same port)
server_port=4000

# Parameter that controls the RMI port used by the RemoteSampleListenerImpl (The Controler)
# Default value is 0 which means port is randomly assigned
# You may need to open Firewall port on the Controller machine
client.rmi.localport=4000

# To use a specific port for the JMeter server engine, define
# the following property before starting the server:
server.rmi.localport=4000

5.启动 JMeter 服务器/从机:

jmeter-server -Djava.rmi.server.hostname=54.179.XXX.XXX

其中 54.179.XXX.XXX 是 EC2 服务器的公共(public) IP 地址

6.启动 JMeter 客户端/主机:

jmeter -Djava.rmi.server.hostname=121.73.XXX.XXX

其中 121.73.XXX.XXX 是我客户端计算机的公共(public) IP 地址。

7.运行 JMeter 测试套件。

enter image description here JMeter GUI 日志输出

成功!

关于testing - JMeter 与远程服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11712080/

相关文章:

python - 使用 Django 进行测试驱动开发

git - 当 gitlab-CI 管道失败时阻止提交

perl - 无法在 Perl Catalyst 应用程序中使用 Test::WWW::Mechanize::Catalyst 在测试用例中打印变量/哈希

amazon-ec2 - 无法保存状态 : open terraform. tfstate:权限被拒绝

mongodb - JSR223 (Groovy) 无法在 Jmeter(2.13) 中访问 MongoDB(3.0.3)

java - 从 junit 测试启动 jmeter

检查 Android Espresso NoMatchingViewException

amazon-web-services - 在 Elastic Beanstalk 中禁用自动安全组命名

amazon-web-services - CloudFormation Windows 实例引导

testing - 更好的 jmeter 报告