Associating a VIP with a database within a Mutual Failover Db2 instance

You can associate a virtual IP address (VIP) with a database in a Mutual Failover Db2 instance by using the Db2 Cluster Manager (db2cm) utility.

Before you begin

Important: In Db2® 11.5.8 and later, Mutual Failover high availability is supported when using Pacemaker as the integrated cluster manager. In Db2 11.5.6 and later, the Pacemaker cluster manager for automated fail-over to HADR standby databases is packaged and installed with Db2. In Db2 11.5.5, Pacemaker is included and available for production environments. In Db2 11.5.4, Pacemaker is included as a technology preview only, for development, test, and proof-of-concept environments.

About this task

The following placeholders are used in the command statements throughout this procedure. These represent values that you can change to suit your organization:
  • <host1> is the host name that is to be assigned a VIP within the Mutual Failover Db2 instance.
  • <instance_name> is the name of the Db2 instance on the Pacemaker-managed Linux cluster.
  • <partition_number> is the number assigned to the target partition on the cluster.

Procedure

  1. As the root user, create a VIP for the primary host in the Db2 instance:
    ./sqllib/bin/db2cm -create -primaryVIP <vip_for_host1>  -partition <partition_mumber> -instance <instance_name>
  2. As the root user, verify that the resource is created successfully:
    ./sqllib/bin/db2cm -list

Examples

The following example shows the command syntax and output from creating a VIP for a host, heat-2, on the Db2 instance db2inst1 (see step 1) :
(root@heat-2) /root
$ /db2hamf/db2inst1/sqllib/bin/db2cm -create -primaryVIP 10.11.82.36 -partition 0 -instance db2inst1
VIP resource for partition 0 created successfully.
The following example shows the command syntax and output from verifying that a VIP has been added to the cluster domain heat (see step 2):
(root@heat-2) /root
$ /db2hamf/db2inst1/sqllib/bin/db2cm -list
      Cluster Status
 
Domain information:
Domain name               = heat
Pacemaker version         = 2.1.2-4.db2pcmk.el8
Corosync version          = 3.1.6
Current domain leader     = heat-2
Number of nodes           = 2
Number of resources       = 5
 
Node information:
Name            State
----------------    --------
heat-2              Online
heat-1              Online
 
Resource Information:
 
Resource Name             = db2_heat-1_eth0
  State                         = Online
  Managed                       = true
  Resource Type                 = Network Interface
    Node                        = heat-1
    Interface Name              = eth0
 
Resource Name             = db2_heat-2_eth0
  State                         = Online
  Managed                       = true
  Resource Type                 = Network Interface
    Node                        = heat-2
    Interface Name              = eth0
 
Resource Name             = db2_db2inst1_0
  State                         = Online
  Managed                       = true
  Resource Type                 = Partition
  Instance                      = db2inst1
  Partition                     = 0
  Current Host                  = heat-2
 
Resource Name             = db2_db2inst1_0-VIP
  State                         = Online
  Managed                       = true
  Resource Type                 = IP
    Node                        = heat-2
    Ip Address                  = 10.11.82.36
  Location                      = heat-2
 
Resource Name             = db2_db2inst1_0-mnt_db2hamf
  State                         = Online
  Managed                       = true
  Resource Type                 = File System
  Device                        = "/dev/sdb"
  Mount Point                   = "/db2hamf"
  File System Type              = ext3
  Mount Options                 = \
  Current Host                  = heat-2
The output shows that a VIP, db2_db2inst1_0-VIP, is added to the cluster domain.