Scaling up Db2

You can run a patch command to add more memory and CPU to the Db2 service on IBM Software Hub to support high-availability or increase processing capacity.

About this task

Db2 does not support the cpd scale command, but you can use the provided script to scale up Db2 to use any increased operating system capacity.

Procedure

  1. Run the following command to find the respective Db2uCluster or Db2uInstance resource names .
    oc get db2ucluster,db2uinstance --all-namespaces
  2. Set the Db2uCluster or Db2uInstance custom resource name to the DB2_CR_ID environment variable
    DB2_CR_ID=<db2ucluster_cr_name/db2uinstance_cr_name>
  3. Run the following command for Db2uCluster or Db2uInstance to configure your namespace:
    For Db2uCluster
    namespace=$(oc get db2ucluster --all-namespaces | grep ${DB2_CR_ID} | awk {'print $1'})
    For Db2uInstance
    namespace=$(oc get db2uinstance --all-namespaces | grep ${DB2_CR_ID} | awk {'print $1'})
  4. Use the following commands to patch the Red Hat® OpenShift® Db2uCluster or Db2uInstance custom resource for the Db2 pod to set memory and CPU limits.

    In the following examples, we patch the Db2uCluster or Db2uInstance custom resources with these entries to set CPU to 12 vCPU and memory to 36 Gi.

    oc patch db2ucluster ${DB2_CR_ID} -n ${namespace} --type merge --patch '{"spec": {
    "podConfig": {
        "db2u": {
            "resource": {   
                "db2u": {
                    "limits": {
                        "cpu": "12",
                        "memory": "36Gi"
                    }
                }
            }
        }
    }
    }}'
    oc patch db2uinstance ${DB2_CR_ID} -n ${namespace} --type merge --patch '{"spec": {
    "podConfig": {
        "db2u": {
            "resource": {   
                "db2u": {
                    "limits": {
                        "cpu": "12",
                        "memory": "36Gi"
                    }
                }
            }
        }
    }
    }}'

    After the patch command, your Db2 pod will restart. Wait for Ready state to indicate 1/1 to confirm that your Db2 pod is ready for use.