Modifying the $DB2InstHome/sqllib/db2nodes.cfg file for DB2

DB2 uses the $DB2InstHome/sqllib/db2nodes.cfg file during failover from one node to another.

To modify the $DB2InstHome/sqllib/db2nodes.cfg file for non-MPP versions

  1. Open the $DB2InstHome/sqllib/db2nodes.cfg file.
  2. Add an entry for database partition.
  3. For IPv4, assign the virtual IP address as the hostname, for example for this step and the previous step:
    0 virtualhostname 0
    1 virtualhostname 1

    Note that the virtualhostname corresponds to the virtual IP address in the /etc/hosts file. Make sure that the virtual IP address is up and works.

  4. For IPv6, DB2 has a limitation that the hostname entries in db2nodes.cfg need to correspond to the hostname of the node. For example, if the hostname is sysA-v6, db2nodes.cfg should contain sysA-v6.

    With VCS, use virtual hostnames. When the service group fails over to another node, the virtual IP address is brought up on the target node. As a workaround for the limitation where the hostname entries in db2nodes.cfg need to correspond to the hostname of the node, you can use something similar to the following configuration.

    On each node, create a /local/$DB2InstHome/db2nodes.cfg file with same permission as that of $DB2InstHome and create a symbolic link to this file from $DB2InstHome/sqllib/db2nodes.cfg.

    # mkdir -p /local/$DB2InstHome/
    # ln -s /local/$DB2InstHome/db2nodes.cfg \
    $DB2InstHome/sqllib/db2nodes.cfg

    The path /local/$DB2InstHome/db2nodes.cfg is local to each system. Enter the IPv6 hostname in the/local/$DB2InstHome/db2nodes.cfg on each node.

    For example, on nodes sysA-v6 and sysB-v6, enter the following in their respective db2nodes.cfg files.

    • On sysA-v6:

      0 sysA-v6 0
    • On sysB-v6:

      0 sysB-v6 0

To modify the $DB2InstHome/sqllib/db2nodes.cfg file for MPP versions

  1. For MPP versions, modify the file $DB2InstHome/sqllib/db2nodes.cfg with the hostname that you want each database partition to start on. DB2 automatically changes and updates the db2nodes.cfg file to enable the database partitions to fail over from one node to another. DB2 adds a fourth column for the "netname". Netname is an IP address of the high speed interconnect for the communication of Fast Communication Manager (FCM). Netname is required only if you are using a high speed interconnect for database partition communications. If the netname is not specified, it is by default the hostname. The virtual IP is not used in the db2nodes.cfg file for MPP configurations when we configure more than one database partition.

    For example when the high speed interconnect (FCM switch) is not used:

    0 sysA 0
    1 sysB 0
    2 sysC 0
    3 sysD 0

    For example when the high speed interconnect (FCM switch) is used for inter-partition communication:

    0 sysA 0 switchA
    1 sysB 0 switchB
    2 sysC 0 switchC
    3 sysD 0 switchD

    Make sure that the relative port number in the third column is unique for each partition on a host. For example when the high speed interconnect (FCM switch) is not used:

    0 sysA 0
    1 sysA 1
    2 sysB 0
    3 sysC 0
    4 sysD 0

    For example when the high speed interconnect (FCM switch) is used for inter-partition communication:

    0 sysA 0 switchA
    1 sysA 1 switchA
    2 sysB 0 switchB
    3 sysC 0 switchC
    4 sysD 0 switchD
  2. If a high speed communication switch/netname is configured for inter partition communication, add entry of the switchname/netname in the db2 global registry using db2greg command before bringing the partitions online using db2start or db2gcf commands. Execute db2greg command, after sourcing the db2profile from DB2 Instance's home directory as mentioned below

    # source /db2_mnt/db2inst1/sqllib/db2profile

    # db2greg -addvarrec variable=switchname, value=$switch

    To verify the entry of switchname is the db2 global registry use the below command

    # db2greg -dump