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
- Create a new GoGrid virtual machine.
- Remember to take your first steps with a brand new Ubuntu virtual machine
- Create a test page. Use the nano editor
- Put the name of the virtual machine in it.
Hello from im01
- Save the file.
- Make a URL from your VM's IP address and the file name. http://220.127.116.11/hello.txt
- Point your web browser at your test URL. A simple page appears.
Set up the second machine
- Create a second GoGrid virtual machine.
- Create a test page containing the second VM's name.
- 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.
- Return to the grid page of the management console.
- Click add. An Add a New Object window opens.
- 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.
- 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
- 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 (18.104.22.168) 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)
- Save your work. A Successfully Added banner appears briefly. Your machine's IP address is added to the Real IP table.
- Fill in the Add/Edit Real IP form again. This time it's for your second GoGrid VM im02.
Add a Health Checker
- 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)
- Save your work.
Add a VIP
- Fill in the VIP form. Grid > Networking > VIP
- Data Center: US-West-1
- Name: vip1
- Description: Nick's first GoGrid VIP
- Status: Enabled
- Find the dropdown box labeled Assign a real IP.
- Select im01 (22.214.171.124).
- Click Assign. A new line is added to the Real IP List table.
- Repeat these Assign a real IP steps for im02 (126.96.36.1996)
- Save your work. A warning appears about spending money.
- Acknowledge the warning. Click yes. A new line is added to the VIP table.
Add a listener
- Fill in the Listener form. Grid > Networking > Listener
- Data Center: US-West-1
- Name: lis1
- Description: Nick's first GoGrid listener
- VIP: vip1 (188.8.131.52)
- Protocol: HTTP
- Listener Port: 80
- Real Port: 80
- Health Checker: hc1 (HTTP)
- Persistence: None
- Cookie Name: (empty)
- Algorithm: Weighted Round Robin
- Save your work.
Check your work
- Open a CLI using an SSH client.
- Connect and login to your first GoGrid VM.
- Watch the web server's activity log:
<code>root@04580-1-1799349:~# <strong>tail -f /var/log/apache2/access.log</strong> </code>
<code>184.108.40.206 - - [12/Jun/2013:10:13:00 -0700] "GET / HTTP/1.0" 200 453 "-" "-"</code>
<code>220.127.116.11 - - [12/Jun/2013:10:13:10 -0700] "GET / HTTP/1.0" 200 453 "-" "-"</code>
<code>18.104.22.168 - - [12/Jun/2013:10:13:20 -0700] "GET / HTTP/1.0" 200 453 "-" "-"</code>
Every ten seconds a new line is written to the log, showing the Health Checker in action.
- Repeat this activity log check on your second GoGrid VM.
- Leave these two running. You can see what happens when you perform this next check with a web browser.
- Return to your web browser.
- Make a URL from the VIP and your new hello page. http://22.214.171.124/hello.txt
- Point your web browser at the new URL. The name of one of the VMs appears: Hello from im02
- Reload the page a few times. Eventually the name of the other VM appears: Hello from im01
- Check the CLI again. Find your requests in the logs.
- Log out of the VMs.
- Close the CLIs.
- Use the GoGrid console to delete the VMs and the load balancer.
- Log out of the console.
- 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.