Create Node Group (CRTNODGRP) command

This section uses two CL command examples to show how to create a node group by using the Create Node Group (CRTNODGRP) command.

In the following example, a node group with default partitioning (equal partitioning across the systems) is created:
CRTNODGRP NODGRP(LIB1/GROUP1) RDB(SYSTEMA SYSTEMB SYSTEMC SYSTEMD)
          TEXT('Node group for test files')

In this example, the command creates a node group that contains four nodes. Note that each of the nodes must be defined RDB entries (previously added to the relational database directory using the ADDRDBDIRE command) and that one node must be defined as local (*LOCAL).

The partitioning attributes default to assigning one-fourth of the partitions to each node number. This node group can be used on the NODGRP parameter of the Create Physical File (CRTPF) command to create a distributed file. For more information about distributed files, see Creating distributed files with DB2® Multisystem.

In the following example, a node group with specified partitioning is created by using the partitioning file (PTNFILE) parameter:
CRTNODGRP NODGRP(LIB1/GROUP2) RDB(SYSTEMA SYSTEMB SYSTEMC)
          PTNFILE(LIB1/PTN1)
          TEXT('Partition most of the data to SYSTEMA')

In this example, the command creates a node group that contains three nodes (SYSTEMA, SYSTEMB, and SYSTEMC). The partitioning attributes are taken from the file called PTN1. This file can be set up to force a higher percentage of the records to be located on a particular system.

The file PTN1 in this example is a partitioning file. This file is not a distributed file, but a regular local physical file that can be used to set up a custom partitioning scheme. The partitioning file must have one 2-byte binary field. The partitioning file must contain 1024 records in which each record contains a valid node number.

Figure 1. Example of the contents of partitioning file PTNFILE
In this graphic of a partitioning file with a 2–byte binary field, Row 1 corresponds to partition number 0, and Row 1024 corresponds to partition number 1023.

If the node group contains three nodes, all of the records in the partitioning file must have numbers 1, 2, or 3. The node numbers are assigned in the order that the RDB names were specified on the Create Node Group (CRTNODGRP) command. A higher percentage of data can be forced to a particular node by having more records containing that node number in the partitioning file. This is a method for customizing the partitioning with respect to the amount of data that physically resides on each system. To customize the partitioning with respect to specific values residing on specific nodes, use the Change Node Group Attributes (CHGNODGRPA) command. See Changing node groups using the CHGNODGRPA command with DB2 Multisystem for more information.

You should note that, because the node group information is stored in the distributed file, the file is not immediately sensitive to changes in the node group or to changes in the RDB directory entries that are included in the node group. You can make modifications to node groups and RDB directory entries, but until you use the CHGPF command and specify the changed node group, your files do not change their behavior.

Another concept is that of a visibility node. A visibility node within a node group contains the file object (part of the mechanism that allows the file to be distributed across several nodes), but no data. A visibility node retains a current level of the file object at all times; the visibility node has no data stored on it. In contrast, a node (sometimes called a data node) contains data. As an example of how you can use a visibility node in your node group, assume that the iSeries™ server that your sales executives use is part of your node group. These executives probably do not want to run queries on a regular basis, but on occasion they might want to run a specific query. From their server, they can run their queries, access real-time data, and receive the results of their query. So even though none of the data is stored on their server, because their system is a visibility node, the executives can run the query whenever necessary.

To specify a node as being a visibility node, you must use the PTNFILE parameter on the Create Node Group (CRTNODGRP) command. If the partitioning file contains no records for a particular node number, that node is a visibility node.

Related concepts
How node groups work with DB2 Multisystem
Distributed files with DB2 Multisystem
Change Node Group Attributes (CHGNODGRPA) command