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.
- 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.
- Install the operator
- Create the secrets for the SSL security configuration
- 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.
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
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
type: "existing"
claimName: c-db2u-ftm-db-backup #Backup PVC name
mountPath: /mnt/backup
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