Add an HADR database resource to the cluster domain

You can add a database resource to an HADR Db2 instance running on a Pacemaker-managed Linux cluster by using the Db2 Cluster Manager (db2cm) utility.

Before you begin

The following prerequisites must be met before proceeding with the rest of the procedure:
  • The target database must exist in the current instance.
  • The HADR_PEER_WINDOW value must be set.

About this task

The following placeholders are used in the command statements throughout this procedure:
  • <database_name> is the name of the Db2 database on the HADR database resource.
  • <instance_name> is the name of the Db2® instance on the cluster

Procedure

  1. As the root user, create the database resource for your Db2 instance:
    ./sqllib/bin/db2cm -create -db <database_name> -instance <instance_name>
  2. As the root user, verify that the resource is created successfully:
    ./sqllib/bin/crm status

Examples

The following example shows the command syntax and output from adding a database resource called SAMPLE to the Db2 instance, db2inst1 (see step 1):
[root@ignited1 ~]# sqllib/bin/db2cm -create -db SAMPLE -instance db2inst1
Database resource for SAMPLE created successfully
The following example shows the command syntax and output from verifying that the database resource is added to the cluster domain (see step 2):

[root@ignited1 ~]# crm status
Stack: corosync
Current DC: ignited1 (version 2.0.2-1.el8-744a30d655) - partition with quorum
Last updated: Tue Mar 10 14:07:35 2020
Last change: Tue Mar  3 11:50:52 2020 by db2inst2 via cibadmin on cuisses1
     
2 nodes configured
6 resources configured
 
Online: [ cuisses1 ignited1 ]
 
Full list of resources:
     
db2_cuisses1_eth0      (ocf::heartbeat:db2ethmon):     Started cuisses1
db2_ignited1_eth0      (ocf::heartbeat:db2ethmon):     Started ignited1
db2_cuisses1_db2inst1_0        (ocf::heartbeat:db2inst):       Started cuisses1
db2_ignited1_db2inst2_0        (ocf::heartbeat:db2inst):       Started ignited1
Clone Set: db2_db2inst1_db2inst2_SAMPLE-clone [db2_db2inst1_db2inst2_SAMPLE] (promotable)
     Masters: [ cuisses1 ]
     Slaves: [ ignited1 ]
The db2_db2inst1_db2inst2_SAMPLE-clone is the new database resource created for the SAMPLE database in the cluster domain.