Table of contents

Installing Db2

A project administrator can install Db2 on IBM® Cloud Pak for Data.

Permissions you need for this task
You must be an administrator of the OpenShift® project (Kubernetes namespace) where you will deploy Db2.
Information you need to complete this task
  • Db2 requires a custom security context constraint (SCC). For details, see Creating required SCCs.
  • Db2 can be installed in either:
    • The project where Cloud Pak for Data is installed
    • A project that is tethered to the project where Cloud Pak for Data is installed
  • Db2 uses the following storage classes. If you don't use these storage classes on your cluster, ensure that you have a storage class with an equivalent definition:
    • OpenShift Container Storage:
      • For system data and backup data: ocs-storagecluster-cephfs (RWX)
      • For user data: ocs-storagecluster-ceph-rbd (RWO with 4K sector size)
    • NFS: managed-nfs-storage
    • Portworx:
      • For system data and backup data: portworx-db2-rwx-sc (RWX)
      • For user data: portworx-db2-rwo-sc (RWO with 4K block size)
    • IBM Cloud File Storage: ibmc-file-gold-gid
    • IBM Spectrum® Scale:
      • For system data and backup data: portworx-db2-rwx-sc (RWX)
      • For user data: portworx-db2-rwo-sc (RWO with 4K block size)
      • For system data and backup data: ibm-spectrum-scale-csi (RWX)
      • For user data: ibm-spectrum-scale-csi (RW) with 4K sector size)
    Db2® also supports local storage.

Before you begin

Ensure that the cluster meets the minimum requirements for installing Db2. For details, see System requirements.

Additionally, ensure that a cluster administrator completed the required Pre-installation tasks for your environment. Specifically, verify that a cluster administrator completed the following tasks:

  1. Cloud Pak for Data is installed. For details, see Installing Cloud Pak for Data.
  2. For environments that use a private container registry, such as air-gapped environments, the Db2 software images are mirrored to the private container registry. For details, see Mirroring images to your container registry.
  3. The cluster is configured to pull the Db2 software images. For details, see Configuring your cluster to pull images.
  4. The Db2 operator subscription exists. For details, see Creating operator subscriptions.
  5. The security context constraints (SCCs) required to run Db2 exists. For details, see Creating required SCCs.

If these tasks are not complete, the Db2 installation will fail.

Procedure

Complete the following tasks to install Db2:

  1. Installing the service
  2. Verifying the installation
  3. What to do next

Installing the service

To install Db2:

  1. Log in to Red Hat® OpenShift Container Platform as a user with sufficient permissions to complete the task:
    oc login OpenShift_URL:port
  2. Create a Db2oltpService custom resource to install Db2. Follow the appropriate guidance for your environment.
    • The recommended storage class names are described in Setting up shared persistent storage.

      Create a custom resource with the following format.

      cat <<EOF |oc apply -f -
      apiVersion: databases.cpd.ibm.com/v1
      kind: Db2oltpService
      metadata:
        name: db2oltp-cr     # This is the recommended name, but you can change it
        namespace: project-name     # Replace with the project where you will install Db2
      spec:
        license:
          accept: true
          license: Advanced|Standard|Community     # Specify the license you purchased
      EOF
    • Important: Use a storage class with attributes similar to the storage class described in the Service persistent storage requirements section of Storage requirements.

      Create a custom resource with the following format.

      cat <<EOF |oc apply -f -
      apiVersion: databases.cpd.ibm.com/v1
      kind: Db2oltpService
      metadata:
        name: db2oltp-cr     # This is the recommended name, but you can change it
        namespace: project-name     # Replace with the project where you will install Db2
      spec:
        license:
          accept: true
          license: Advanced|Standard|Community     # Specify the license you purchased
      EOF

When you create the custom resource, the Db2 operator installs Db2.

Verifying the installation

When you create the custom resource, the Db2 operator processes the contents of the custom resource and starts up the microservices that comprise Db2, including Db2oltpService. (The Db2oltpService microservice is defined by the db2oltp-cr custom resource.) Db2 is installed when the Db2oltpService status is Completed.

To check the status of the installation:

  1. Change to the project where you installed Db2:
    oc project project-name
  2. Get the status of Db2 (db2oltp-cr):
    oc get Db2oltpService db2oltp-cr -o jsonpath='{.status.db2oltpStatus} {"\n"}'

    Db2 is ready when the command returns Completed

What to do next

Deploy the Db2 service.