Create clusters using scripting


Use wsadmin to create appserver, generic server, and proxy server clusters. A cluster is a set of servers managed together as a way to balance workload.

There are multiple ways to complete this task. This page uses the AdminConfig object to create clusters in the environment. Alternatively, we can use the ClusterConfigCommands command group for the AdminTask object or the createCluster script in the AdminClusterManagement script library to create and configure clusters.

 

  1. Launch the wsadmin scripting tool using the Jython scripting language.

  2. Identify the server to convert to a cluster. Determine the configuration ID of the server of interest and assign it to the server variable...

    • Jacl...

      set server [$AdminConfig getid /Cell:mycell/Node:mynode/Server:server1/]

    • Jython...

      server = AdminConfig.getid('/Cell:mycell/Node:mynode/Server:server1/')

  3. Convert the existing server to a cluster.

    Use the convertToCluster command for the AdminConfig object to convert the existing server to a cluster. Specify the name of the server and the name to assign to the cluster, as the following example demonstrates. The resourcesScope parameter is not a required parameter. If it is not included in the command the server resources are copied to the cluster scope, with the cluster resources being overwritten.

    The following values can be specified for this parameter:

    • both, null, or empty String: The server resources are copied to the cluster scope. This results in the cluster scope resources being over written by the server scope resources. The resources on the server scope remain unchanged.

    • cluster: The server resources are moved to the cluster scope. This results in the cluster scope resources being over written by the server scope resources. The resources on the server scope are deleted with the exception with the EJBTimer attributes in the resources.xml and the resources-cei.xml resources remaining on the server scope.

    • server: Any resources from both the cluster scope and the server scope remain where they are unchanged.

    • Jacl...

      $AdminConfig convertToCluster $server myCluster1 resourcesScope

    • Jython...

      AdminConfig.convertToCluster(server, 'myCluster1' resourcesScope)

    For example...

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

  4. Save the configuration changes...

    AdminConfig.save()

  5. In a network deployment environment only, synchronize the node. Use the syncActiveNodes script in the AdminNodeManagement script library to propagate the changes to all active nodes...

    AdminNodeManagement.syncActiveNodes()


Clusters and workload management

 

Related tasks


Create clusters
Use the AdminConfig object for scripted administration
Create a proxy server cluster

 

Related


Cluster configuration scripts
Commands for the AdminConfig object