Configuring one slave per machine

In this configuration, we will set up three slave machines and control them with one master client. This will mimic having four separate physical machines with one of them acting as the master (where the JMeter GUI client runs) and the other three machines acting as slave nodes (where the JMeter server scripts are kicked-off). Perform the following steps:

  1. Download the Vagrant project provided for this section from https://github.com/ptwj/slave_master/archive/v3.zip.
  2. Extract the contents to a folder of your choice, for example, ch6_01.
  3. On the command line, go to the extracted folder.
  4. Run vagrant up n1.
  5. If prompted, choose the appropriate connection to bridge. If you are on a wireless connection, for example, choose en1: Wi-Fi. If you are on Ethernet, choose en0: Ethernet, and so on.

In a few moments, a fully functional VirtualBox will be created with JMeter installed and ready to run! You should see logs similar to the following:

 Bringing machine 'n1' up with 'virtualbox' provider...
==> n1: Importing base box 'ubuntu/xenial64'...
==> n1: Matching MAC address for NAT networking...
==> n1: Checking if box 'ubuntu/xenial64' is up to date...
==> n1: Setting the name of the VM: slave_master_n1_1498024105418_4996
==> n1: Clearing any previously set network interfaces...
==> n1: Preparing network interfaces based on configuration...
n1: Adapter 1: nat
n1: Adapter 2: hostonly
==> n1: Forwarding ports...
n1: 22 (guest) => 2222 (host) (adapter 1)
==> n1: Running 'pre-boot' VM customizations...
==> n1: Booting VM...
==> n1: Waiting for machine to boot. This may take a few minutes... ...

Don't take our word for it though. Verify that the box is properly configured by performing the following on the command line (from the same folder you ran vagrant up n1 from):

vagrant ssh n1 cd /opt/apache-jmeter-3.2/bin ./jmeter --version

This should show you the version of JMeter that you are running on the guest machine. In my case, as you can see in the following log, it reports Version 3.2 r1790748 or similar:

ubuntu@xenial64:~$ cd /opt/apache-jmeter-3.2/bin
ubuntu@xenial64:/opt/apache-jmeter-3.2/bin$ ./jmeter --version
_ ____ _ ____ _ _ _____ _ __ __ _____ _____ _____ ____
/ | _ / / ___| | | | ____| | | / | ____|_ _| ____| _
/ _ | |_) / _ | | | |_| | _| _ | | |/| | _| | | | _| | |_) |
/ ___ | __/ ___ |___| _ | |___ | |_| | | | | |___ | | | |___| _ <
/_/ \_\_| /_/ \_\____|_| |_|_____| \___/|_| |_|_____| |_| |_____|_| \_ 3.2 r1790748
Copyright (c) 1999-2017 The Apache Software Foundation

We provisioned our JMeter installation to reside at /opt/apache-jmeter-3.2. For the rest of this section, we'll refer to this location (/opt/apache-jmeter-3.2) as JMETER_HOME.

If we attempt to kick-off JMeter server on this node now (from the apache-jmeter-3.2/bin directory, run ./jmeter-server), we will encounter an error such as the following:

ubuntu@xenial64:/opt/apache-jmeter-3.2/bin$ ./jmeter-server
Created remote object: UnicastServerRef [liveRef: [endpoint:[127.0.0.1:44285](local),objID:[-2a2e4c3a:15cc939ed8a:-7fff, -8845414168141820345]]]
Server failed to start: java.rmi.RemoteException: Cannot start. xenial64 is a loopback address.
An error occurred: Cannot start. xenial64 is a loopback address.

This is because the server is returning an IP address of 127.0.1.1, which is considered a loop back address. To fix this, we need to find out the assigned IP address of the virtual machine and edit $JMETER_HOME/bin/jmeter-server to add that IP address. To get the assigned IP address from the newly created virtual machine, run this on the command line:

ifconfig | grep inet

The line of interest here is the line containing 192.168.x.x or 172.x.x.x depending on your network. For our node, the assigned IP address is 172.28.128.3:

inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe26:6cc6/64 Scope:Link inet addr:172.28.128.3 Bcast:172.28.128.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:feda:ecbc/64 Scope:Link inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host 

Now, edit $JMETER_HOME/bin/jmeter-server using an editor of choice. Vim comes with the virtual machine we just created, so edit the file using the vi $JMETER_HOME/bin/jmeter-server command. Look for the line beginning with RMI_HOST_DEF and add the following just after it:

RMI_HOST_DEF=-Djava.rmi.server.hostname=172.28.128.3 
Ensure that you replace the 172.28.128.3 here with the assigned IP address of your own virtual box.

Save the file (by pressing Esc, then typing :wq) and this machine is ready to act as a server. Before we configure a second node, it would be wise to take it for a spin. Let's run JMETER_HOME/bin/jmeter-server again on the machine. This time, it should succeed, and you should see something similar to the following on the console:

Created remote object: UnicastServerRef [liveRef: [endpoint:[172.28.128.3:45760](local),objID:[-666cc1cc:15cc93d56bd:-7fff, -1076151357528166058]]]

Now it is waiting for instructions from the master. Let's go right ahead and configure the master to control it.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.134.90.44