+

Search Tips   |   Advanced Search

Create cluster members using scripting


Use wsadmin to create cluster members in appserver, generic server, Web server, and proxy server clusters.

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

The template options are available only for the first cluster member that you create. All cluster members that you create after the first member will be identical. A template is stored in the cluster scope that use to create additional cluster members.

 

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

  2. There are two ways to perform this task. Choose one of the following:

    • Use the AdminTask object:

      • Jacl...

        $AdminTask createClusterMember {-interactive} resourcesScope

      • Jython...

        AdminTask.createClusterMember ('[-interactive]') resourcesScope

        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.

    • Use the AdminConfig object:

      1. 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

        For example...

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

      2. 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

        For example...

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

      3. (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

        For example...

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

      4. Create the new cluster member, by using 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

          • Jython...

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

          For example...

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

  3. Save the configuration changes...

    AdminConfig.save()

  4. 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, as the following example demonstrates:

    AdminNodeManagement.syncActiveNodes()

 

Related tasks


Modify cluster member templates using scripting
Use the AdminConfig object for scripted administration

 

Related


Create a cluster: Create additional cluster members
Cluster configuration scripts
Commands for the AdminConfig object
Create a cluster: Create first cluster member