Monday, February 19, 2018

Add New Load Balanced Service To Netscaler

For this example we have two web servers, rdc2bob010 & rdc2bob011, configured on the addresses 10.160.16.163 & 10.160.16.164.
We have allocated a Virtual IP Address (VIP) to the load balanced service of 10.160.20.233.
Load Balancing is included with the Standard Edition of NetScaler and NetScaler Express, the free Licenses for the VPX, so long as you have a valid license installed then you will be able to use the load balancing feature.Enable Load Balancing Feature
If not already enabled:
enable feature LB
show feature | grep LB
If we are not sure on the feature name to enable then use the "show feaure" command first and review the output
With load balancing now enabled we can move onto creating the necessary elements to load balance

Elements of Load Balancing

In order to set up basic load balancing on the Netscalers, you need to:
1. Add Servers - the physical servers that connections will be pushed to
2. Add Services - the logical services that reside on the physical servers - HTTP, HTTPS, FTP, etc
3. Create a Virtual Server - the virtual server that clients connect to and that gets load balanced
4. Bind Services to Virtual Servers - Which services reside on the selected Virtual Server

Creating Load Balanced Services

Create entries for backend servers

First we need to create entries for the back-end servers that we will be load balancing across. We have two web servers on our private network so we will create records for them first.
add server rdc2bob010 10.160.16.163
add server rdc2bob011 10.160.16.164
show server
Netscaler show server.png

Create service entries

Now we need to create entries for the services to load balance: With the servers created we now need to create records for the services, in this case HTTP and the servers they are linked to
add service rdc2bob010_443 rdc2bob010 HTTP 443
add service rdc2bob011_443 rdc2bob011 HTTP 443
show service
Netscaler show service.png

Create virtual server entry

Next, we create the virtual server for load balancing:
The virtual server will be assigned an IP Address, often this would be a public address and the DNS record for the website would point to this address. The load balancing method can be Round Robin as in the entry, valid entries include LEASTCONNECTION, LEASTRESPONSETIME, URLHASH, DOMAINHASH. The default is LEASTCONNECTION.
add lb vserver dc2_lb_vs_bobj_pre_443 http 10.160.20.233 443
show vserver lbvswww
Netscaler show lb vserver.png
Part of the output of the show vserver command will show the current state of the load balanced services, this way we can check which services are available to load balance across

Bind services to Virtual Server

To actually make all this work, you need to bind the services to the lb vserver.
bind lb vserver dc2_lb_vs_bobj_pre_443 rdc2bob010_443
bind lb vserver dc2_lb_vs_bobj_pre_443 rdc2bob011_443
Now when we access the virtual server with the a web browser, 10.160.20.233 our connection will be assigned to each server as per LEASTCONNECTION. The DNS record for the website that we need to access should be pointing to this address, the address of the vserver and not the individual web server records.

No comments: