Install, configure, and deploy Db2 on Red Hat OpenShift

If you want to use Db2U for your database, set up and configure a Db2® Universal Container (Db2U) database to use with your Red Hat® OpenShift® cluster.

The following sections describe how to install, configure, and deploy Db2 on Red Hat OpenShift.
  1. If you want to use static storage instead of dynamic, create the network storage directory structure and persistent volumes for Db2U. For more information, see Create the network storage directory structure and persistent volumes for Db2U.
  2. Install the operator
  3. Create the secrets for the SSL security configuration
  4. Deploy the operator
The following sections have example YAML to show how to deploy the operator.

Install the operator

The Db2 operator is part of the IBM® catalog. It can be installed from the OperatorHub after the IBM catalog source is created. For more information about installing this Db2 offering, see https://www.ibm.com/docs/en/db2/11.5?topic=db2-installing-operator.

Create the secrets for the SSL security configuration

You need to create the Red Hat OpenShift secrets that are necessary to enable SSL communication with your Db2U instances. The information about how to create these secrets is in the Db2 Certificates section of the security document that is available to entitled users. This security document is contained in the entitled documentation fix pack that is provided for the version of the offering that you are using. For more information about getting this document, see Security information for FTM on Red Hat OpenShift.

After you create the Red Hat OpenShift secrets that are needed, you can deploy the Db2U instances. You need to specify the Db2U secret name and certificate label name in the following dictionary of the YAML.
spec:
  environment:
    ssl:
Sample values for this dictionary are shown in the example YAML.

The same Red Hat OpenShift Container Platform secret is used by the Db2U instances and the FTM instances.

Deploy the operator

After the Db2 operator is installed, deploy it by using the Db2uCluster API interface. The Db2uCluster instances can be created in the same namespace as the FTM instances. For more information about deploying the Db2 operator, see https://www.ibm.com/docs/en/db2/11.5?topic=db2-deploying-using-db2ucluster-api.

Example YAML for the FTM database

The following example YAML is for the FTM database. You might need to change some of these example values when you are configuring your specific environment.
apiVersion: db2u.databases.ibm.com/v1
kind: Db2uCluster
metadata:
  name: db2u-ftm-db
spec:
  license:
    accept: true
  version: "11.5.7.0-cn4"  # Use the most recent version of Db2U
  size: 1
  affinity: # This block is needed only when dedicated nodes are set up. If not, comment it out.
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
        - matchExpressions:
          - key: icp4data
            operator: In
            values:
            - database-db2oltp
  tolerations: # This block is needed only when dedicated nodes are set up. If not, comment it out.
  - key: "icp4data"
    operator: "Equal"
    value: "database-db2oltp"
    effect: "NoSchedule"
  environment:
    dbType: db2oltp
    database:
      name: FTMDB
      ssl:                     # SSL configuration for certificates
        certLabel: ftm-cert
        secretName: ftm-db2-ssl-cert-secret
      dbConfig:
        SELF_TUNING_MEM: "ON"
        DBHEAP: "AUTOMATIC"
        SORTHEAP: "AUTOMATIC"
        SHEAPTHRES_SHR: "AUTOMATIC"
        MAXLOCKS: "AUTOMATIC"
        LOCKLIST: "AUTOMATIC"
        LOGBUFSZ: "4096"
        LOCKTIMEOUT: "60"
        NUM_IOCLEANERS: "AUTOMATIC"
        NUM_IOSERVERS: "AUTOMATIC"
        PCKCACHESZ: "AUTOMATIC"
        CHNGPGS_THRESH: "30"
        STMTHEAP: "AUTOMATIC"
        APPLHEAPSZ: "2048"
        LOGFILSIZ: "25000"
        LOGPRIMARY: "40"
        LOGSECOND: "0"
        AUTO_MAINT: "OFF"
        AUTO_TBL_MAINT: "OFF"
        AUTO_RUNSTATS: "OFF"
        AUTO_STMT_STATS: "OFF"
        MON_REQ_METRICS: "BASE"
        MON_ACT_METRICS: "BASE"
        MON_OBJ_METRICS: "BASE"
        MON_LOCKTIMEOUT: "HISTORY"
        MON_DEADLOCK: "HISTORY"
        MON_LOCKWAIT: "NONE"
        LOGARCHMETH1: "OFF"
    instance:
      registry:
        DB2_USE_FAST_PREALLOCATION: "OFF"
        DB2_SKIPINSERTED: "OFF"
        DB2_INLIST_TO_NLJN: "YES"
        DB2_EVALUNCOMMITTED: "ON"
        DB2_SELECTIVITY: "YES"
        DB2_SKIPDELETED: "ON"
        DB2COMM: "TCPIP"
        DB2_PARALLEL_IO: "*"
      dbmConfig:
        NUMDB: "2"
        DFT_MON_BUFPOOL: "ON"
        DFT_MON_LOCK: "ON"
        DFT_MON_SORT: "ON"
        DFT_MON_STMT: "ON"
        DFT_MON_UOW: "ON"
        DFT_MON_TABLE: "ON"
        DFT_MON_TIMESTAMP: "ON"
  addOns:    
    rest:     
      enabled: false
    graph:     
      enabled: false
  podConfig:
    db2u:
      resource:
        db2u:
          requests:
            cpu: 2
            memory: 4Gi
          limits:
            cpu: 2
            memory: 4Gi
  storage:
  - name: meta
    type: "create"
    spec:
      storageClassName: "managed-nfs-storage"
      accessModes:
        - ReadWriteMany
      resources:
        requests:
          storage: 10Gi
  - name: data
    type: "create"
    spec:
      storageClassName: "managed-nfs-storage"
      accessModes:
        - ReadWriteMany
      resources:
        requests:
          storage: 100Gi
  - name: backup
    type: "create"
    spec:
      storageClassName: "managed-nfs-storage"
      accessModes:
        - ReadWriteMany
      resources:
        requests:
          storage: 50Gi

Example YAML for the Duplicate Detect database

This database is used when Duplicate Detect is installed. It uses the existing backup persistent volume claim (PVC) that is used to copy the FTM database backups. The claim name and mount path need to be provided, and the type needs to be set to existing. The following example shows these parameters.
    type: "existing"
    claimName: c-db2u-ftm-db-backup       #Backup PVC name
    mountPath: /mnt/backup
The following example YAML is for the Duplicate Detect database. You might need to change some of these example values when you are configuring your specific environment.

apiVersion: db2u.databases.ibm.com/v1
kind: Db2uCluster
metadata:
  name: db2u-izhdup-db
spec:
  license:
    accept: true
  version: "11.5.7.0-cn4"  # Use the most recent version of Db2U
  size: 1
  affinity: # This block is needed only when dedicated nodes are set up. If not, comment it out.
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
        - matchExpressions:
          - key: icp4data
            operator: In
            values:
            - database-db2oltp
  tolerations: # This block is needed only when dedicated nodes are set up. If not, comment it out.
  - key: "icp4data"
    operator: "Equal"
    value: "database-db2oltp"
    effect: "NoSchedule"
  environment:
    dbType: db2oltp
    database:
      name: IZHDUPDB
      ssl:                 # SSL configuration for certificates
        certLabel: ftm-cert
        secretName: ftm-db2-ssl-cert-secret
      dbConfig:
        SELF_TUNING_MEM: "ON"
        DBHEAP: "AUTOMATIC"
        SORTHEAP: "AUTOMATIC"
        SHEAPTHRES_SHR: "AUTOMATIC"
        MAXLOCKS: "AUTOMATIC"
        LOCKLIST: "AUTOMATIC"
        LOGBUFSZ: "4096"
        LOCKTIMEOUT: "60"
        NUM_IOCLEANERS: "AUTOMATIC"
        NUM_IOSERVERS: "AUTOMATIC"
        PCKCACHESZ: "AUTOMATIC"
        CHNGPGS_THRESH: "30"
        STMTHEAP: "AUTOMATIC"
        APPLHEAPSZ: "2048"
        LOGFILSIZ: "25000"
        LOGPRIMARY: "40"
        LOGSECOND: "0"
        AUTO_MAINT: "OFF"
        AUTO_TBL_MAINT: "OFF"
        AUTO_RUNSTATS: "OFF"
        AUTO_STMT_STATS: "OFF"
        MON_REQ_METRICS: "BASE"
        MON_ACT_METRICS: "BASE"
        MON_OBJ_METRICS: "BASE"
        MON_LOCKTIMEOUT: "HISTORY"
        MON_DEADLOCK: "HISTORY"
        MON_LOCKWAIT: "NONE"
        LOGARCHMETH1: "OFF"
    instance:
      registry:
        DB2_USE_FAST_PREALLOCATION: "OFF"
        DB2_SKIPINSERTED: "OFF"
        DB2_INLIST_TO_NLJN: "YES"
        DB2_EVALUNCOMMITTED: "ON"
        DB2_SELECTIVITY: "YES"
        DB2_SKIPDELETED: "ON"
        DB2COMM: "TCPIP"
        DB2_PARALLEL_IO: "*"
      dbmConfig:
        NUMDB: "2"
        DFT_MON_BUFPOOL: "ON"
        DFT_MON_LOCK: "ON"
        DFT_MON_SORT: "ON"
        DFT_MON_STMT: "ON"
        DFT_MON_UOW: "ON"
        DFT_MON_TABLE: "ON"
        DFT_MON_TIMESTAMP: "ON"
  addOns:    
    rest:     
      enabled: false
    graph:     
      enabled: false
  podConfig:
    db2u:
      resource:
        db2u:
          requests:
            cpu: 2
            memory: 4Gi
          limits:
            cpu: 2
            memory: 4Gi
  storage:
  - name: meta
    type: "create"
    spec:
      storageClassName: "managed-nfs-storage"
      accessModes:
        - ReadWriteMany
      resources:
        requests:
          storage: 10Gi
  - name: data
    type: "create"
    spec:
      storageClassName: "managed-nfs-storage"
      accessModes:
        - ReadWriteMany
      resources:
        requests:
          storage: 100Gi
  - name: backup
    type: "existing"
    claimName: c-db2u-ftm-db-backup
    mountPath: /mnt/backup
    spec:
      storageClassName: "managed-nfs-storage"
      accessModes:
        - ReadWriteMany
      resources:
        requests:
          storage: 50Gi