Create cluster members using scripting

 

Overview

We can also use the AdminTask object to perform this task. For more about using the AdminTask object to create cluster members, see the Commands for AdminTask object article. To create cluster members using the AdminConfig object, perform the following steps:

 

Procedure

  1. Start wsadmin

  2. Identify the existing cluster and assign it to the cluster variable:

    • Jacl:

      set cluster [$AdminConfig getid /ServerCluster:myCluster1/]
      
      

    • Jython

      cluster = AdminConfig.getid('/ServerCluster:myCluster1/')
      print cluster
      

    Example output

    myCluster1(cells/mycell/cluster/myCluster1|cluster.xml#ServerCluster_1)
    

  3. Identify the node to create the new server and assign it to the node variable:

    • Jacl:

      set node [$AdminConfig getid /Node:mynode/]
      
      

    • Jython

      node = AdminConfig.getid('/Node:mynode/')
      print node
      

    Example output:

    mynode(cells/mycell/nodes/mynode|node.xml#Node_1)
    

  4. (Optional) Identify the cluster member template and assign it to the serverTemplate variable:

    • Jacl:

      set serverTemplate [$AdminConfig listTemplates Server]
      

    • Jython

      serverTemplate = AdminConfig.listTemplates('Server')
      print serverTemplate
      

    Example output

    server1(templates/default/nodes/servers/server1|server.xml#Server_1)
    

  5. Create the new cluster member, by using the createClusterMember command.

    • The following example creates the new cluster member, passing in the existing cluster configuration ID, existing node configuration ID, and the new member attributes:

      • Jacl:

        $AdminConfig createClusterMember $cluster $node {{memberName clusterMember1}}
        

      • Jython

        AdminConfig.createClusterMember(cluster, node, [['memberName', 'clusterMember1']])
        

    • The following example creates the new cluster member with a template, passing in the existing cluster configuration ID, existing node configuration ID, the new member attributes, and the template ID:

      • Jacl:

        $AdminConfig createClusterMember $cluster $node {{memberName clusterMember1}} $serverTemplate
        $AdminConfig save
        

      • Jython

        print AdminConfig.createClusterMember(cluster, node, [['memberName',  'clusterMember1']], serverTemplate)
        

      Example output

      clusterMember1(cells/mycell/clusters/myCluster1|cluster.xml$ClusterMember_2)
      

  6. In a network deployment environment only, synchronize the node.


 

See Also


AdminConfig object for scripted administration

 

See Also


Commands for the AdminConfig object