Setup JMeter 3-Node Cluster on AWS EC2
- Login to Your AWS Account
- Launch EC2 Instance with following configuration
1. Choose Ubuntu OS
2. Choose t2.medium Instance type
3. Open port 1099, 50000, 22, 80, 60000, 2377
4. Launch 4 Instance i.e. 1-Master, 3-Node/Slave
3. Login your all 4 Instance and update all
sudo apt-get update
4. Install Docker on all 4 Instance
5. Next, install a few prerequisite packages which let apt
use packages over HTTPS
sudo apt install apt-transport-https ca-certificates curl software-properties-common
6. Then add the GPG key for the official Docker repository to your system
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
7. Add the Docker repository to APT sources
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
8. This will also update our package database with the Docker packages from the newly added repo.
Make sure you are about to install from the Docker repo instead of the default Ubuntu repo
apt-cache policy docker-ce
9. Finally, install Docker
sudo apt install docker-ce
10. Check docker status
sudo systemctl status docker
11. Now Install Docker-Compose only on Master Instance
# curl -L https://github.com/docker/compose/releases/download/1.11.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
# chmod +x /usr/local/bin/docker-compose
12. Setting Up Docker Swarm on Master Node
docker swarm init --listen-addr <master-private-ip>:2377 --advertise-addr <master-private-ip>:2377
13. Now setup docker-swarm on slave node, so copy above command when you will configure docker swarm on master as per image
docker swarm join --token <TOKEN> master-private-ip <-- Run this command on all the slave nodes
14. Login again master and pull following repository
# git clone https://github.com/ajeetraina/jmeter-docker
# cd jmeter-docker
15. Now Run the Docker-Compose file
sudo docker stack deploy -c docker-compose.yml myjm
16. Verify with following command on Master-Node
docker service ls
17. Now verify on all 3-Slave nodes
docker ps
18. Now Push your .JMX file inside running docker
docker exec -i <container-running-on-master-node> sh -c 'cat > /jmeter/apache-jmeter-2.13/bin/jmeter-docker.jmx' < jmeter-docker.jmx
19. Start the load testing now
# docker exec -it <container-on-master-node> bash
#cd /jmeter/apache-jmeter-2.13/bin
$./jmeter -n -t jmeter-docker.jmx -R < - list of containers running on slave nodes seperated by commas)
20. That’s it.