If your database is to operate in a partitioned database environment, you must create a node configuration file called db2nodes.cfg.
To enable database partitioning, the db2nodes.cfg file must be located in the sqllib subdirectory of the home directory for the instance before you start the database manager. This file contains configuration information for all database partitions in an instance, and is shared by all database partitions for that instance.
Windows considerations
If you are using DB2® Enterprise Server Edition on Windows, the node configuration file is created for you when you create the instance. You should not attempt to create or modify the node configuration file manually. You can use the db2ncrt command to add a database partition server to an instance. You can use the db2ndrop command to drop a database partition server from an instance. You can use the db2nchg command to modify a database partition server configuration including moving the database partition server from one computer to another; changing the TCP/IP host name; or, selecting a different logical port or network name.
dbpartitionnum hostname [logical-port [netname]]
Once a database partition number is assigned, it cannot be changed. (Otherwise the information in the distribution map, which specifies how data is distributed, would be compromised.)
If you drop a database partition, its database partition number can be used again for any new database partition that you add.
NODE nnnn
The nnnn is
the database partition number, which is left-padded with zeros. This
database partition number is also used by the CREATE DATABASE and DROP
DATABASE commands.(There is an exception when netname is specified. In this situation, netname is used for most communications, with hostname only being used for db2start, db2stop, and db2_all.)
The combination of the IP address and the logical port is used as a well-known address, and must be unique among all applications to support communications connections between database partitions.
For each hostname, one logical-port must be either 0 (zero) or blank (which defaults to 0). The database partition associated with this logical-port is the default node on the host to which clients connect. You can override this with the DB2NODE environment variable in db2profile script, or with the sqlesetc() API.
The following example shows a possible node configuration file for a system on which SP2EN1 has multiple TCP/IP interfaces, two logical partitions, and uses SP2SW1 as the DB2 database interface. It also shows the database partition numbers starting at 1 (rather than at 0), and a gap in the dbpartitionnum sequence:
dbpartitionnum | hostname | logical-port | netname |
---|---|---|---|
1 | SP2EN1.mach1.xxx.com | 0 | SP2SW1 |
2 | SP2EN1.mach1.xxx.com | 1 | SP2SW1 |
4 | SP2EN2.mach1.xxx.com | 0 | |
5 | SP2EN3.mach1.xxx.com |
You can update the db2nodes.cfg file using an editor of your choice. (The exception is: an editor should not be used on Windows.) You must be careful, however, to protect the integrity of the information in the file, as database partitioning requires that the node configuration file is locked when you issue START DBM and unlocked after STOP DBM ends the database manager. The START DBM command can update the file, if necessary, when the file is locked. For example, you can issue START DBM with the RESTART option or the ADD DBPARTITIONNUM option.