Modify cluster member templates using scripting
Use the AdminConfig object and wsadmin to modify cluster member templates for appserver, generic server, and proxy server clusters.
A copy of the first cluster member that you create is stored in the cluster scope as a template. We can create the first cluster member using any existing server as a template or a default server template. You can also create a first cluster member when creating the cluster by converting a server to a cluster. By creating a first cluster member, the template of the cluster member is stored under the scope of the cluster. Additional cluster members are created using the cluster member template stored in the cluster scope. A cluster can be either homogeneous or heterogeneous in nature. A homogeneous cluster spans nodes that are of the same product version. A heterogeneous cluster spans nodes of different products versions.
Since a cluster can contain members from nodes that run on different versions of WAS ND, one template will be stored for each version of the application server node configured as a cluster member. The cluster member template will not exist for a given node version until you create a first member in a node of the same version. For example, if a cluster contains several V7 nodes and several V6.1 nodes, there will be one cluster member template for the V7 nodes and one for the V6.1 nodes, such as the following:
- The $WAS_HOME/config/clusters/clusterName/servers/V7.0MemberTemplate template will be used as the template for any member that is created in a V7.0 node.
- The $WAS_HOME/config/clusters/clusterName/servers/V6.1MemberTemplate template will be used as the template for any member that is created in a V6.1 node.
- The $WAS_HOME/config/clusters/clusterName/servers/V6MemberTemplate template will be used as the template for any member that is created in a V6 node.
- The $WAS_HOME/config/clusters/clusterName/servers/V5MemberTemplate template will be used as the template for any member that is created in a V5 node.
Therefore, when you make a configuration change to cluster members, make the same configuration change to the template that is stored in the corresponding cluster scope in order to keep the template in sync with the existing members. Similarly, when you make a configuration change to the template, you should make the same configuration change to existing cluster members.
We can modify a cluster member template using wsadmin similar to how you modify a server. We cannot modify a cluster member template using the admin console. Perform the following steps to modify a cluster member template using wsadmin:
- Launch the wsadmin scripting tool using the Jython scripting language.
- Obtain the cluster template under the cluster scope. For example, the following example obtains the version 6.1 cluster member template for the cluster1 cluster:
- Jacl...
set c [$AdminConfig listTemplates Server cluster1/servers/V7.0]
puts [$AdminConfig showall $c]Jython...
c = AdminConfig.listTemplates('Server','cluster1/servers/V7.0')
print AdminConfig.showall(c)
- Modify the attributes of the template. For example:
- Jacl...
$AdminConfig modify $c {{attrName attrVal}}Jython...
AdminConfig.modify(c, [[attrName, attrVal]])
- Save the configuration changes. See the Saving configuration changes with wsadmin article for more information.
- In a network deployment environment only, synchronize the node. See the Synchronizing nodes with wsadmin article for more information.
Related tasks
Create cluster members using scripting
Use the AdminConfig object for scripted administration
Related
Cluster configuration scripts
Commands for the AdminConfig object
Cluster member templates collection
Proxy cluster member templates collection