This blog post is part 4 in the “build your own IaaS” series where we create a small cloud based testing environment for scalable applications that mimics an internally hosted testing lab. Part 1 discussed different virtual machine hosting models, Part 2 discussed the DHCP configuration, and part 3 was all about starting a new Virtual Machine (with the XenServer APIs). This blog post describes how to setup Netscaler load balancer (virtual machine) on XenServer.
We downloaded an evaluation virtual machine of the Netscaler VPX load balancer, which (among many other features) has SOAP APIs for dynamically adding and removing web servers. This is useful when an application starts a new virtual machine running a web server, and the load balancer has to be dynamically updated.
Step 1 – download the netscaler VPX to the XenServer “Local Storage”
Browse to https://www.citrix.com/English/SS/downloads/results.asp?productId=21679 and copy the download link of the Netscaler Virtual appliance. Leave the website open, as in a later step we would need to generate a license file for the VPX just downloaded.
Mount the network access storage It should look similiar to the following (replace the XXX below with your details) :
mount -t cifs //nasXXX.service.softlayer.com/SLXXXX-X -o username=SLXXXX-1,password=XXXXXX /mnt/share
Then download the Netscaler VPX file
nohup wget http://pastlink.xva &
Step 2 – import the Netscaler VPX file to XenServer
Before importing the vm, find and copy the UUID of the “Local storage” folder on your xenserver using the “xe sr-list” command:
Then import the VPX file into that strage repository uuid (replace with your filename and UUID)
xe vm-import filename=/mnt/share/nsvpx-9.2-47.11_cl.xva sr-uuid=3b71ea3c-cdb3-b78e-4eae-a79c3a2c7008
Notice that a machine called “Netscaler Virtual Appliance” was added to XenCenter.
Step 3 – Netscaler VPX first boot
During the first boot of the netscaler virtual machine, your would be asked for its primary IP address. Recall the 3 IP addresses that we reserved for the load balancer in part 2 .
Right the Netscaler virtual machine and choose start. Switch to the Console tab, and wait until you are asked to type in the network IP Address, netmask and gateway.
After the VM completed its first boot, switch to the network tab again and make sure it got the correct IP addresses. Type the ip address of the load balancer in your browser and login with username nsroot (password nsroot).
Wait a minute or so until the Setup Wizard pops up. Enter the 2nd ip address:
Step 4 – Netscaler evaluation license installation
After completing the wizard, expand the navigation tree on the left and select the “System” node. Look for the Netscaler unique hostid that is required to generate an evaluation license.
Go back to the download page and look for the “Get License” button. This starts a multi stage registration and license generation process that concludes with downloading a LIC file.
Once you’ve got the file select the “System->Licenses” tree node, and in the bottom left click the “Manage Licenses” button. Click the “Add license” button and browse to the LIC file you’ve just downloaded. The Load Balancer will then reboot.
Step 5 – Fix timezone settings
After a minute or so, the login page appears and you can login again with the nsroot/nsroot credentials . This time select the “System->Settings” tree menu.
Click the “Change time zone” link and choose the same time zone applied for the rest of the machines.
Step 6 – Configure a virtual load balancer
Then click “Configure Basic Features” and select “Load Balancing”
We’re almost done. Select th
e “Load Balancing->Virtual Servers” tree node. “Vritual Servers” is actually your new application’s ip address. It is the url to which your customers browse to.On the bottom left corner click the “Add” button.In the “Create Virtual Server” window that opens we enter the application name “petclinic” and the 3rd IP Address reserved for the load balancer. You may also want to check the “Method and Persistence” tab and configure the load balancing algorithm and sticky sessions. For more info check out the Traffic Management Guide (also installed with Netscaler, look for the “Documentation” tab at the top right corner of the Netscaler web interface).
When finished, click the “Create” button (once) and then the “Close” button.
That’s it for today. Feel free to leave your comments below.