| < Day Day Up > |
|
CSM allows nodes to be grouped either by a host name list or via dynamic selection criteria based on node attributes.
In Example 6-19 we define a new group, TestGroup, containing the first three nodes of our cluster. We use nodegrp -a (add nodes to a group) to create the group. We then display (print) the contents of that group using nodegrp -p.
Example 6-19: Creating and displaying a new nodegroup with nodegrp
[root@master /]# nodegrp -a node1,node2,node3 TestGroup [root@master /]# nodegrp -p TestGroup node1.cluster.com node2.cluster.com node3.cluster.com [root@master /]#
Individual nodes may be subsequently removed from a group using nodegrp -x, as shown in Example 6-20.
Example 6-20: Removing nodes from a group using nodegrp -x
[root@master /]# nodegrp -x node2 TestGroup [root@master /]# nodegrp -p TestGroup node1.cluster.com node3.cluster.com [root@master /]#
Dynamic groups are created by defining a select statement or "where" clause. Example 6-21 shows the creation of a dynamic group consisting of all the nodes managed via mgrsa1.
Example 6-21: Creating a dynamic group with nodegrp -w
[root@master /]# nodegrp -w "HWControlPoint=='mgrsa1.cluster.com'" RSA1Nodes [root@master /]# nodegrp -p RSA1Nodes node1.cluster.com node2.cluster.com node3.cluster.com node4.cluster.com [root@master /]#
The select clause of dynamic groups my be displayed using the "-W" switch. Example 6-22 shows the select clause of the predefined node group RedHat73Nodes.
Example 6-22: Displaying the select clause of a dynamic group using nodegrp -W
[root@master /]# nodegrp -W RedHat73Nodes InstallDistributionName=='RedHat' && InstallDistributionVersion=='7.3' [root@master /]#
Both static and dynamic groups are removed using -D. Groups must be removed one at a time:
# nodegrp -D TestGroup # nodegrp -D RSA1Nodes
If any predefined nodegroups are accidentally removed or modified, they may be restored with predefined-nodegroups. Using the -f switch, all the predefined groups (AllNodes, ManagedNodes, and so on) will be initialized to their default setting:
# predefined-nodegroups -f
This will not affect any user created groups, whether static or dynamic.
| < Day Day Up > |
|