db2cm command reference for HADR-configured clusters
You can use the Db2® cluster manager (db2cm) utility to configure and administer an HADR Db2 instance on a Pacemaker-managed Db2 Linux cluster.
Attention: Ensure that the HADR_SYNCMODE database configuration parameter is set to SYNC
or NEARSYNC. Automated HADR failover is supported only by these HADR synchronization modes.
Command syntax
Command parameters
- -create
-
- -cluster
-
Creates a new Pacemaker cluster domain with two hosts and the public Ethernet resource from scratch. The following parameters are mandatory:
- -domain domainName
- Specifies the name of the Pacemaker domain
- -host hostName
- Specifies the name of the host. The hostname provided must be the short host name.
- -publicEthernet publicEthernetDeviceName
- Specifies the name of the public network adapter on the host specified in the previous argument.
Different device names can be used on the hosts. For example,
sqllib/bin/db2cm -create -cluster -domain MyPCSDomain -host host1 -publicEthernet eth0 -host host2 -publicEthernet eth2
- -aws
- Indicates that the specified resource will be configured for an Amazon Web
Services (AWS) cloud environment.
- -primaryVIP ipv4Address
- Associates an overlay IP address with the primary role of the database and instance specified. Ensure you complete all prerequisite steps before running this command.
- -standbyVIP ipv4Address
- Associates an overlay IP address with the standby role of the database and instance specified, to facilitate reads on standby. Ensure you complete all prerequisite steps before running this command.
- -fence
- Configures the AWS fencing agent for clusters on AWS.
- -profile profileName
- The ‘default’ AWS profile is used to make API calls to AWS if one is not specified in the profile.
- -rtb routingTableList
- A comma-delimited list of routing tables, where each list item is an AWS route table ID that is local to the VPC.
- -db databaseName
- The name of the database on the cluster.
- -instance instanceName
- The name of the Db2 instance on the cluster.
- -azure
- Indicates that the specified resource will be configured for a Microsoft
Azure cloud environment.
- –primarylbl port -db databaseName –instance instanceName
- Associates an Azure load balancer health probe resource with the primary database and instance specified. The port provided must be the health probe port of the Azure load balancer. A unique load balancer must be configured for the primary and standby role of each database. Ensure you complete all prerequisite steps before running this command.
- –standbylbl port -db databaseName –instance instanceName
- Associates an Azure load balancer health probe resource with the standby database and local instance specified. The port provided must be the health probe port of the Azure load balancer. A unique load balancer must be configured for the primary and standby role of each database. Ensure you complete all prerequisite steps before running this command.
- -fence
- Configures the Azure fencing agent for clusters on Azure. Ensure you complete all prerequisite steps before running this command.
- -gc
- Indicates that the specified resource will be configured for a Google Cloud environment.
- –primarylbl ipv4Addres -db databaseName –instance instanceName
- Associates the virtual IP address with the primary role of the database and instance specified.
- –standbylbl ipv4Addres -db databaseName –instance instanceName
- Associate the virtual IP address with the standby role of the database and instance specified to facilitate read on standby feature.
- –primarylbl port -db databaseName –instance instanceName
- Creates a Load Balancer resource of type ‘gcp-ilb’. The resource listens and responds to the GC health check and enables the GC backend to redirect the network traffic to the right node in the cluster. A unique load balancer must be configured for the primary role of each database. Ensure you complete all prerequisite steps before running this command.
- –standbylbl port -db databaseName –instance instanceName
- Creates a Load Balancer resource of type ‘gcp-ilb’. The resource listens and responds to the GC health check and enables the GC backend to redirect the network traffic to the right node in the cluster. A unique load balancer must be configured for the standby role of each database. Ensure you complete all prerequisite steps before running this command.
- -fence
- Configures the Google Cloud fencing agent for clusters on Google Cloud. Ensure you complete all prerequisite steps before running this command.
- -instance instanceName -host hostNameOfTheInstance
- Creates the instance resource and its resource model for the specified host.For example,
sqllib/bin/db2cm -create -instance db2inst1 -host host1 - -public Ethernet publicEthernetDeviceName -host hostName
- Add a public Ethernet resource to the resource model with the name of the public network adapter
on a host specified. Different device name can be used on different hosts. Each host can only have
one public Ethernet resource.For example,
sqllib/bin/db2cm -create -publicEthernet eth0 -host host1 - -db databaseName -instance instanceName
- Add HADR database resource of the specified instance on the local host to the resource
model.For example,
sqllib/bin/db2cm -create -db employeeDB -instance db2inst1 - -primaryVIP ipv4Address [-netmask subnet-mask] -db databaseName [-instance instanceName]
- Associate the virtual IP address with the primary role of the database and instance specified.
The default netmask is auto-detected. The criteria of the VIP is for it to be on the same IP subnet
as the associated local IPs on both hosts. The optional netmask parameter can be used to override
the auto-detection. The IP address must be in IPv4 format. The optional netmask input can be
in either the CIDR or the 32 bit format. You can create only one VIP resource for each
database.For example,
sqllib/bin/db2cm -create -primaryVIP 170.120.1.1 -netmask 21 -db employeeDB -instance db2inst1 sqllib/bin/db2cm -create -primaryVIP 170.120.1.1 -netmask 255.255.248.0 -db employeeDB -instance db2inst1 - -standbyVIP ipv4Address [-netmask subnet-mask] -db databaseName [-instance instanceName]
- Associate the virtual IP address with the standby role of the database to facilitate read on
standby feature. The default netmask is auto-detected. The criteria of the VIP is for it to be on
the same IP subnet as the associated local IPs on both hosts. The optional netmask parameter can be
used to override the auto-detection. The IP address must be in IPv4 format. The optional netmask input can be in either the CIDR or the 32 bit format.
You can create only one VIP resource for each database.For example,
sqllib/bin/db2cm -create -standbyVIP 170.120.1.1 -netmask 21 -db employeeDB -instance db2inst1 sqllib/bin/db2cm -create -standbyVIP 170.120.1.2 -netmask 255.255.248.0 -db employeeDB -instance db2inst1 - -qdevice quorum_device_host_name
- Creates the quorum device for the corosync cluster.For example,
sqllib/bin/db2cm -create -qdevice hostQDevice
- -delete
-
- -domain
- Removes the resource model, deletes the cluster. Upon completion of this command, there should
be no left-over Pacemaker process or
resources on the current host.For example,
sqllib/bin/db2cm -delete -domain - -aws
- Indicates that the specified resource to be removed is configured for an AWS cloud environment.
- -primaryVIP databaseName –instance instanceName
- Deletes the IP address that is associated with the primary role of the database and instance specified.
- -standbyVIP databaseName –instance instanceName
- Deletes the IP address that is associated with the standby role of the database and instance specified.
- -fence
- The AWS fencing configuration.
- -db databaseName
- The name of the database on the cluster.
- -instance instanceName
- The name of the Db2 instance on the cluster.
- -azure
- Indicates that the specified resource to be removed is configured for a Microsoft Azure cloud environment.
- -gc
- Indicates that the specified resource to be removed is configured for a Google Cloud environment.
- -disable
-
-
-all
- Disable the automation for all Pacemaker resources of
all Db2
instances in the Pacemaker domain.For example,
sqllib/bin/db2cm -disable –all - -instance instanceName -host hostNameOfTheInstance
- Disable the automation for the instance on the specified host. All the resources associated with
the instance are also disabled.For example,
sqllib/bin/db2cm -disable -instance db2inst1 -host host1Note: The db2cm command does not manage resources created outside of the db2cm utility. This includes cloud specific resources created manually to facilitate fencing, Virtual IPs, or other cloud specific setup as per Db2 supplied instructions. For more information on disabling cloud specific resources, see Public cloud vendors supported with Db2 Pacemaker.
- Disable the automation for all Pacemaker resources of
all Db2
instances in the Pacemaker domain.
- -enable
-
-
-all
- Enable the automation for all Pacemaker resources of
all Db2
instances in the Pacemaker domain. This
option is meant to undo the disable
-all operation.For example,
sqllib/bin/db2cm -enable –all - -instance instanceName -host hostNameOfTheInstance
- Enable the automation for the instance on the specified host. All the resources associated with
the instance are also enabled. This option is meant to undo the disable -instance
instanceName -host hostNameOfTheInstance
operation.For example,
sqllib/bin/db2cm -enable -instance db2inst1 -host host1Note: The db2cm command does not manage resources created outside of the db2cm utility. This includes cloud specific resources created manually to facilitate fencing, Virtual IPs, or other cloud specific setup as per Db2 supplied instructions. For more information on enabling cloud specific resources, see Public cloud vendors supported with Db2 Pacemaker.
- Enable the automation for all Pacemaker resources of
all Db2
instances in the Pacemaker domain. This
option is meant to undo the disable
-all operation.
- -list
- Display the cluster configuration and status information.For example,
sqllib/bin/db2cm -list - -dump
- Export cluster information pertaining to the local host to a compressed file in the local
directory. Use this for problem determination to collect data before contacting Db2 support. A
db2cm.zip file is created under the directory where the tool is run.For example,
sqllib/bin/db2cm -dump - -export
- Backup the cluster configuration to a file which can be used with the -import
option to quickly redeploy the cluster on the same set of hosts.For example,
For more information, see Backing-up cluster configuration information.sqllib/bin/db2cm -export /tmp/backup.conf - -import
- Restore the cluster configuration from a previously saved configuration generated by the
-export option.For example,
For more information, see Restore from a saved Pacemaker cluster configuration.sqllib/bin/db2cm -import /tmp/backup.conf - -copy_resources resourceAgentsPath -host hostName
- Copies resource agent scripts from the specified path to the resources path on the specified
host.For example,
sqllib/bin/db2cm -copy_resources /tmp/20220830_Db2MutualFailover_Pacemaker_Beta1/Db2AgentScripts/ -host host1 - -help
- Print usage information for db2cm.For example,
sqllib/bin/db2cm -help - -add -instance instanceName
- Adds mount resources of a database to an existing HADR partition.
- -remove -instance instanceName
- Removes mount resources of a database to an existing HADR partition.
- -grant -adminUser userName
- Grants cluster administrator privilege to the userid specified. As the user credentials (groups)
are cached in the current login session, you need to log out and log back in for the changes to take
effect.
(gerry@R9GHADR-srv-1) /home/gerry/db2 $ sudo db2cm -grant -adminUser gerry Userid 'gerry' has been granted Cluster Administrator privilege (gerry@R9GHADR-srv-1) /home/gerry/db2 $ db2cm -create -instance gerry -host R9GHADR-srv-1 DBT8235E Userid "gerry" does not have sufficient permission. Reason code: 2. (gerry@R9GHADR-srv-1) /home/gerry $ exit [09:31:37] root@R9GHADR-srv-1.fyre.ibm.com:/root > su - gerry Last login: Thu Aug 1 09:19:29 PDT 2024
