Create cluster members using scripting
You can create cluster members using the AdminConfig object and scripting. Before starting this task, the wsadmin tool must be running. See the Start the wsadmin scripting client article for more information.
Overview
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. For more information about this template, see the Modifying cluster member templates using scripting article.
To create cluster members using the AdminConfig object, perform the following steps:
Procedure
- There are two ways to perform this task. Choose one of the following:
- Use the AdminTask object:
Use Jacl:
$AdminTask createClusterMember {-interactive}
- Use Jython:
AdminTask.createClusterMember ('[-interactive]')
- Use the AdminConfig object:
- Identify the existing cluster and assign it to the cluster variable:
Use Jacl:
set cluster [$AdminConfig getid /ServerCluster:myCluster1/]
- Use Jython:
cluster = AdminConfig.getid('/ServerCluster:myCluster1/') print clusterExample output:
myCluster1(cells/mycell/cluster/myCluster1|cluster.xml#ServerCluster_1)
- Identify the node to create the new server and assign it to the node variable:
Use Jacl:
set node [$AdminConfig getid /Node:mynode/]
- Use Jython:
node = AdminConfig.getid('/Node:mynode/') print node
Example output:
mynode(cells/mycell/nodes/mynode|node.xml#Node_1)
- (Optional) Identify the cluster member template and assign it to the serverTemplate variable:
Use Jacl:
set serverTemplate [$AdminConfig listTemplates Server]
- Use Jython:
serverTemplate = AdminConfig.listTemplates('Server') print serverTemplateExample output:
server1(templates/default/nodes/servers/server1|server.xml#Server_1)
- 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:
Use Jacl:
$AdminConfig createClusterMember $cluster $node {{memberName clusterMember1}}
- Use 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:
Use Jacl:
$AdminConfig createClusterMember $cluster $node {{memberName clusterMember1}} $serverTemplate
- Use Jython:
print AdminConfig.createClusterMember(cluster, node, [['memberName', 'clusterMember1']], serverTemplate)Example output:
clusterMember1(cells/mycell/clusters/myCluster1|cluster.xml$ClusterMember_2)
- Save the configuration changes. See the Saving configuration changes with the wsadmin tool article for more information.
- In a network deployment environment only, synchronize the node. See the Synchronizing nodes with the wsadmin tool article for more information.
Modifying cluster member templates using scripting
Use the AdminConfig object for scripted administration
Related Reference
Commands for the AdminConfig object