Product Documentation

Tutorial: Create a NetScaler Cluster

Sep 08, 2016

This tutorial gives you the step-by-step process to create a NetScaler cluster. After completing this tutorial you will be able to create a two-node NetScaler cluster. To add more appliances to the cluster you must repeat the procedure that adds and joins the node to the cluster.

메모

The executable code for the sample is available in the <NITRO_SDK_HOME>/sample/ directory.

Using Java API to Create a Cluster

  1. Copy the libraries from <NITRO_SDK_HOME>/lib folder to the project classpath.
  2. Create a new class and name it CreateCluster.
  3. Log on to one of the appliances that you want to add to the cluster and create a cluster:
    //Connect to the first appliance that you want to add to the cluster 
    nitro_service nonClipSession0 = new nitro_service(nsipAddress0,protocol); 
    nonClipSession0.login(uName,password); 
     
    //Create a cluster instance 
    clusterinstance newClusterInstance = new clusterinstance(); 
    newClusterInstance.set_clid(1); 
    clusterinstance.add(nonClipSession0,newClusterInstance); 
     
    //Add the appliance to the cluster 
    clusternode ClusterNode0 = new clusternode(); 
    ClusterNode0.set_nodeid(0); 
    ClusterNode0.set_ipaddress(nsipAddress0); 
    ClusterNode0.set_state("ACTIVE"); 
    ClusterNode0.set_backplane("0/1/1"); 
    clusternode.add(nonClipSession0,ClusterNode0); 
     
    //Add the cluster IP address 
    nsip newNSIPAddress = new nsip(); 
    newNSIPAddress.set_ipaddress(clipAddress); 
    newNSIPAddress.set_netmask("255.255.255.255"); 
    newNSIPAddress.set_type("CLIP"); 
    nsip.add(nonClipSession0,newNSIPAddress); 
     
    //Enable the cluster instance 
    clusterinstance.enable(nonClipSession0, newClusterInstance); 
     
    //Save the configurations 
    nonClipSession0.save_config(); 
     
    //Warm reboot the appliance 
    nonClipSession0.reboot(true);

    The cluster is created and the first node is added to the cluster. This node becomes the initial configuration coordinator of the cluster.

  4. Log on to the cluster IP address to add other appliances to the cluster:
    //Connect to the cluster IP address 
    nitro_service clipSession = new nitro_service(clipAddress,protocol); 
    clipSession.login(uName,password); 
     
    //Add the node to the cluster 
    clusternode ClusterNode1 = new clusternode(); 
    ClusterNode1.set_nodeid(1); 
    ClusterNode1.set_ipaddress(nsipAddress1); 
    ClusterNode1.set_state("ACTIVE"); 
    ClusterNode1.set_backplane("1/1/1"); 
    clusternode.add(clipSession,ClusterNode1); 
     
    //Save the configurations 
    clipSession.save_config();
  5. Log on to the appliance that you added in the previous step and join it to the cluster:
    //Connect to the node that you have just added to the cluster 
    nitro_service nonClipSession1 = new nitro_service(nsipAddress1,protocol); 
    nonClipSession1.login(uName,password); 
     
    //Join the node to the cluster 
    cluster newCluster = new cluster(); 
    newCluster.set_clip(clipAddress); 
    newCluster.set_password(password); 
    cluster.join(nonClipSession1,newCluster); 
     
    //Save the configurations 
    nonClipSession1.save_config(); 
     
    //Warm reboot the appliance 
    nonClipSession1.reboot(true);

    The second node is now a part of the cluster.

  6. Verify the details of the cluster by logging on to the cluster IP address
    //Retrieving the cluster node details 
    Long id = new Long(1); 
    clusternode node= clusternode.get(clipSession, id); 
    System.out.println("Node ID: "+ node.get_nodeid() + " | Admin state: " + node.get_state() + " | Backplane interface: "+ node.get_backplane()); 
     
    //Retrieving the cluster instance details 
    Long id1 = new Long(1); 
    clusterinstance instance= clusterinstance.get(clipSession, id1); 
    System.out.println("Cluster instance ID: "+ instance.get_clid() + " | Operational state: " +instance.get_operationalstate());

Using .NET API to Create a Cluster

  1. Copy the libraries from <NITRO_SDK_HOME>/lib folder to the project classpath.
  2. Create a new class and name it CreateCluster.
  3. Log on to one of the appliances that you want to add to the cluster and create a cluster:
    //Connect to the first appliance that you want to add to the cluster 
    nitro_service nonClipSession0 = new nitro_service(nsipAddress0,protocol); 
    nonClipSession0.login(uName,password); 
     
    //Create a cluster instance 
    clusterinstance newClusterInstance = new clusterinstance(); 
    newClusterInstance.clid = 1; 
    clusterinstance.add(nonClipSession0,newClusterInstance); 
     
    //Add the appliance to the cluster 
    clusternode ClusterNode0 = new clusternode(); 
    ClusterNode0.nodeid = 0; 
    ClusterNode0.ipaddress = nsipAddress0; 
    ClusterNode0.state = "ACTIVE"; 
    ClusterNode0.backplane = "0/1/1"; 
    clusternode.add(nonClipSession0,ClusterNode0); 
     
    //Add the cluster IP address 
    nsip newNSIPAddress = new nsip(); 
    newNSIPAddress.ipaddress = clipAddress; 
    newNSIPAddress.netmask = "255.255.255.255"; 
    newNSIPAddress.type = "CLIP"; 
    nsip.add(nonClipSession0,newNSIPAddress); 
     
    //Enable the cluster instance 
    clusterinstance.enable(nonClipSession0, newClusterInstance); 
     
    //Save the configurations 
    nonClipSession0.save_config(); 
     
    //Warm reboot the appliance 
    nonClipSession0.reboot(true);

    The cluster is created and the first node is added to the cluster. This node becomes the initial configuration coordinator of the cluster.

  4. Log on to the cluster IP address to add other appliances to the cluster:
    //Connect to the cluster IP address 
    nitro_service clipSession = new nitro_service(clipAddress,protocol); 
    clipSession.login(uName,password); 
     
    //Add the node to the cluster 
    clusternode ClusterNode1 = new clusternode(); 
    ClusterNode1.nodeid = 1; 
    ClusterNode1.ipaddress = nsipAddress1; 
    ClusterNode1.state = "ACTIVE"; 
    ClusterNode1.backplane = "1/1/1"; 
    clusternode.add(clipSession,ClusterNode1); 
     
    //Save the configurations 
    clipSession.save_config();
  5. Log on to the appliance that you added in the previous step and join it to the cluster:
    //Connect to the node that you have just added to the cluster 
    nitro_service nonClipSession1 = new nitro_service(nsipAddress1,protocol); 
    nonClipSession1.login(uName,password); 
     
    //Join the node to the cluster 
    cluster newCluster = new cluster(); 
    newCluster.clip = clipAddress; 
    newCluster.password = password; 
    cluster.join(nonClipSession1,newCluster); 
     
    //Save the configurations 
    nonClipSession1.save_config(); 
     
    //Warm reboot the appliance 
    nonClipSession1.reboot(true);

    The second node is now a part of the cluster.

  6. Verify the details of the cluster by logging on to the cluster IP address
    //Retrieving the cluster node details 
    uint id = 1; 
    clusternode node= clusternode.get(clipSession, id); 
    System.Console.Out.WriteLine("Node ID: " + node.nodeid + " | Admin state: " + node.state + " | Backplane interface: " + node.backplane); 
     
    //Retrieving the cluster instance details 
    uint id1 = 1; 
    clusterinstance instance= clusterinstance.get(clipSession, id1); 
    System.Console.Out.WriteLine("Cluster instance ID: "+ instance.clid + " | Operational state: " +instance.operationalstate);