Enabling the Db2 REST interface

You can enable the Db2 REST interface for an existing Db2® Warehouse deployment on Cloud Pak for Data.

Procedure

  1. During or after your provisioning of the Db2 Warehouse service instance, you can edit the db2ucluster custom resource. Find your respective db2ucluster resource by running the following command:
    [root@deploysquad2-inf ~]# oc get db2ucluster
    The command results will match your deployment ID, in the example below db2wh-1603819662989:
    NAME                  STATE   AGE
    db2wh-1603819662989   Ready   34m
  2. Run the following command to edit the add-ons file:
    oc edit db2ucluster deployment_ID
    Set the rest value to enabled: true. The edited file should look like the following example:
    addOns:
      rest:
        enabled: true
  3. Run the following command to view the REST service and deployment information:
    oc get formations.db2u.databases.ibm.com db2wh-1603819662989 -o go-template='{{range .status.components}}{{printf "%s,%s,%s\n" .kind .name .status.state}}{{end}}' | column -s, -t 
    The results should look similar to the following example:
    service                c-db2wh-1603819662989-db2u-rest-svc          Creating
    Deployment             c-db2wh-1603819662989-rest                   Creating
  4. Run the following command to view the REST pod as part of your deployment:
    oc get pods |grep db2
    Here is an example with the REST pod highlighted:
    c-db2wh-1603819662989-db2u-0                               1/1     Running     0          39m
    c-db2wh-1603819662989-etcd-0                               1/1     Running     0          39m
    c-db2wh-1603819662989-instdb-df7hh                         0/1     Completed   0          40m
    c-db2wh-1603819662989-ldap-64bc6d58dc-ms29x                1/1     Running     0          40m
    c-db2wh-1603819662989-rest-66f7fcb7d4-98fbh                1/1     Running     0          86s
    c-db2wh-1603819662989-restore-morph-bkfpr                  0/1     Completed   0          39m
    c-db2wh-1603819662989-tools-57bc7d4ddf-wz8fr               1/1     Running     0          40m
    db2u-operator-5999cd944b-dwgrr                             1/1     Running     0          17m
    Note the REST pod name, which is used to run documented REST commands.

What to do next

After you enable the Db2 REST service, you can create the route for the service.