简体   繁体   中英

Connection refused error while connecting to jmeter slave docker container

I'm trying to implement Jmeter distributed framework with Docker. Master and slaves are running on different hosts in ec2. Ports have been opened to allow communication.

Master is stuck with the below message

Starting distributed test with remote engines: [slaveIP:1099] @ Sun Nov 21 04:50:29 GMT 2021 (1637470229447)
Remote engines have been started:[slaveIP:1099]

On the slave side, it is throwing me connection refused errors.

java.rmi.ConnectException: Connection refused to host: 172.17.0.2; nested exception is:

Command to start slave machine:

docker run \
        -dit \
        -p 6000:6000 \
        -p 1099:1099 \
        -v "${volume_path}":${jmeter_path} \
        --rm \
        jmeter \
        -n -s \
        -Jclient.rmi.localport=3000 \
        -Jserver.rmi.localport=6000 \
        -Dserver_port=1099 \
        -Djava.rmi.server.hostname=<HostIP> \
        -Dserver.rmi.ssl.disable=true \
        -j ${jmeter_path}/server/slave_${timestamp}_${IP_ADD}.log

Command to start master

docker run \
  -v "${volume_path}":${jmeter_path} \
  -p 3000:3000 \
  --rm \
  jmeternew \
  -n -X \
   -t ${jmeter_path}/$1 \
  -Dserver.rmi.ssl.disable=true \
  -Dclient.rmi.localport=3000 \
  -R slaveIP:1099 \
  -l ${jmeter_path}/client/result_${timestamp}.jtl \
  -j ${jmeter_path}/client/jmeter_${timestamp}.log

The same commands are working if I'm running master and slave on the same machine. I tried changing the java.rmi.server.hostname=0.0.0.0. It's also throwing me connection refused error

According to:

Just we need:

  • configure the slave machine
  • configure the run machine
  • add the slave ip/ips on the master using the file jmeter/bin/jmeter.properties
  remote_hosts=192.165.0.10,192.165.0.20,192.165.0.30
  • the main and slave ports are randomly assigned so you should use parameters: client.rmi.localport and server.rmi.localport respectively.
  • then start the master jmeter
  • then start the slave jmeter and the connection will be established.

advice

Establish the connection with docker, following and of the several tutorials on the internet. This will help you to detect errors like:

  • firewalls permissions
  • ports configuration on master and slave
  • public/private network restrictions
  • etc

If it works, then use docker to automate it.

  1. You're using 172.17.0.2 which is kind of local network address for Class B networks so your "hosts" might not be able to reach each other, try using public IP addresses instead
  2. You will need to open the RMI ports in your OS firewall and in EC2 security groups
  3. I fail to see why would you need docker there, it doesn't add any value and only making things more complicated and consumes resources
  4. I fail to see the reason for going for the distributed testing there, one master and one slave is equal to one "load generator" machine which means that you can just run your test in command-line non-GUI mode from a single host and get the same results.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM