Cloud

How to create load-balanced VMs on the GoGrid IaaS platform

This step-by-step procedure shows you how to create an enterprise-level web service with high availability on the GoGrid platform.

A few years ago no service provider would have let the general public anywhere near their networking kit. Now they are providing virtual network-building tools. GoGrid are a cloud IaaS provider who built an SDN (Software Defined Networking) architecture as the foundation for their cloud services.  GoGrid's customers don't use these SDN features directly - GoGrid provider a layer of firewall and load balancer services on top of this SDN foundation.

Have a go yourself by building on their hard work. Follow this procedure to create a pair of virtual machines and stick a load balancer in front of them.

This procedure does look pretty complicated, but if you have already managed to create a new GoGrid virtual machine you are halfway there. When you've finished, you will know how to build an enterprise-level web service.

Set up the first GoGrid virtual machine

  1. Create a new GoGrid virtual machine.
  2. Remember to take your first steps with a brand new Ubuntu virtual machine
  3. Create a test page. Use the nano editor nano /var/www/hello.txt
  4. Put the name of the virtual machine in it. Hello from im01
  5. Save the file.

    Check your work.
  6. Make a URL from your VM's IP address and the file name. http://173.1.25.34/hello.txt
  7. Point your web browser at your test URL. A simple page appears.

Set up the second machine

  1. Create a second GoGrid virtual machine.
  2. Create a test page containing the second VM's name.
  3. Check with a web browser.

Create a load balancer

You must configure these building blocks of a load balancer.

  • Real IPs - IP addresses of all web servers.
  • Health Checker - Software that monitors web servers. The load balancer sends requests to the healthy servers.
  • VIP - IP address that clients will send requests to
  • Listener - software that waits for requests

The load balancer makes a server farm using the Real IPs, removes any servers that the Health Checker says are not okay, and passes on requests from the Listener to the server farm.

  1. Return to the grid page of the management console.
  2. Click add. An Add a New Object window opens.
  3. Select Network > Dynamic Load Balancer. The Add a New Object window closes and an Add/Edit VIP form appears. You can also get here using Grid > Networking > VIP.
  4. Don't fill in the VIP form yet - Go to the Real IPs section. Click the Add a Real IP link. An Add/Edit Real IP form appears.

Add Real IPs

  1. Fill in the Add/Edit Real IP form. Grid > Networking > Real IP
    • Data Center: US-West-1 (this is the default)
    • GoGrid IP Addresses: im01 (173.1.25.34) This fills in the rest of the form with your first VM's details.
    • Name: im1
    • Description: Nick's first GoGrid machine
    • Weight: 100
    • Status: Enabled (default)
  2. Save your work. A Successfully Added banner appears briefly. Your machine's IP address is added to the Real IP table.
  3. Fill in the Add/Edit Real IP form again. This time it's for your second GoGrid VM im02.

Add a Health Checker

  1. Fill in the Add/Edit Health Checker form. Grid > Networking > Health Checker
    • Data Center: US-West-1 (default)
    • Name: hc1
    • Description: Nick's first GoGrid health checker
    • Health Checker Type: HTTP
    • URI: /
    • Virtual Host Name: (empty)
    • Interval: 10 seconds
    • Timeout: 5 seconds
    • Response String: (empty)
  2. Save your work.

Add a VIP

  1. Fill in the VIP form. Grid > Networking > VIP
    • Data Center: US-West-1
    • Name: vip1
    • Description: Nick's first GoGrid VIP
    • Status: Enabled
  2. Find the dropdown box labeled Assign a real IP.
  3. Select im01 (173.1.25.34).
  4. Click Assign. A new line is added to the Real IP List table.
  5. Repeat these Assign a real IP steps for im02 (173.1.25.346)
  6. Save your work. A warning appears about spending money.
  7. Acknowledge the warning. Click yes. A new line is added to the VIP table.

Add a listener

  1. Fill in the Listener form. Grid > Networking > Listener
    • Data Center: US-West-1
    • Name: lis1
    • Description: Nick's first GoGrid listener
    • VIP: vip1 (216.121.28.164)
    • Protocol: HTTP
    • Listener Port: 80
    • Real Port: 80
    • Health Checker: hc1 (HTTP)
    • Persistence: None
    • Cookie Name: (empty)
    • Algorithm: Weighted Round Robin
  2. Save your work.

Check your work

  1. Open a CLI using an SSH client.
  2. Connect and login to your first GoGrid VM.
  3. Watch the web server's activity log:

<code>root@04580-1-1799349:~# <strong>tail -f /var/log/apache2/access.log</strong> </code>
<code>216.121.28.164 - - [12/Jun/2013:10:13:00 -0700] "GET / HTTP/1.0" 200 453 "-" "-"</code>
<code>216.121.28.164 - - [12/Jun/2013:10:13:10 -0700] "GET / HTTP/1.0" 200 453 "-" "-"</code>
<code>216.121.28.164 - - [12/Jun/2013:10:13:20 -0700] "GET / HTTP/1.0" 200 453 "-" "-"</code>
<code>...</code>

Every ten seconds a new line is written to the log, showing the Health Checker in action.

  1. Repeat this activity log check on your second GoGrid VM.
  2. Leave these two running. You can see what happens when you perform this next check with a web browser.
  3. Return to your web browser.
  4. Make a URL from the VIP and your new hello page. http://216.121.28.164/hello.txt
  5. Point your web browser at the new URL. The name of one of the VMs appears: Hello from im02
  6. Reload the page a few times. Eventually the name of the other VM appears: Hello from im01
  7. Check the CLI again. Find your requests in the logs.

Clean up

  1. Log out of the VMs.
  2. Close the CLIs.
  3. Use the GoGrid console to delete the VMs and the load balancer.
  4. Log out of the console.
  5. Close the web browser.

You have entered the domain of the Internet experts

You have created a highly available website - that's an enterprise-level skill, previously found only in the domain of the Internet experts earning the big bucks. You used GoGrid's self-service tools to do your work. This was made possible because GoGrid built SDN into their network.

Try expanding your skill set. Follow the procedure again, but this time put the machines in different data centers. Now your High Availability cluster is even more HA.

About

Nick Hardiman builds and maintains the infrastructure required to run Internet services. Nick deals with the lower layers of the Internet - the machines, networks, operating systems, and applications. Nick's job stops there, and he hands over to the ...

0 comments

Editor's Picks