Associate a primary VIP with an existing HADR database of an instance
You can associate a virtual IP address (VIP) with a database in an HADR Db2 instance 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 HADR-enabled database must have an associated HADR resource in the resource model
- An unused IP address on the same IP subnet of the public Ethernet adapter used on both hosts.
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 HADR Db2® instance.
- <database_name> is the name of the Db2 database.
- <instance_name> is the name of the Db2 instance on the cluster.
- <partition_number> is the number assigned to the target partition on the cluster.
Procedure
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@ignited1 ~]# sqllib/bin/db2cm -create -primaryVIP 9.21.107.154 -db SAMPLE -instance db2inst1
Primary VIP resource 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@ignited1 ~]# crm status
Stack: corosync
Current DC: ignited1 (version 2.0.2-1.el8-744a30d655) - partition with quorum
Last updated: Tue Mar 10 14:17:23 2020
Last change: Tue Mar 10 14:17:23 2020 by db2inst2 via cibadmin on cuisses1
2 nodes configured
7 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 ]
db2_db2inst1_db2inst1_SAMPLE-primary-VIP (ocf::heartbeat:IPaddr2): Started cuisses1The
output shows that a VIP, db2_db2inst1_db2inst1_SAMPLE-primary-VIP, is added to the
cluster domain.