Enabling the Db2 REST interface
You can enable the Db2 REST interface for an existing Db2® Warehouse deployment on Cloud Pak for Data.
Procedure
-
During or after your provisioning of the Db2
Warehouse service instance, you can edit
the
db2ucluster
custom resource. Find your respectivedb2ucluster
resource by running the following command:
The command results will match your deployment ID, in the example below[root@deploysquad2-inf ~]# oc get db2ucluster
db2wh-1603819662989
:NAME STATE AGE db2wh-1603819662989 Ready 34m
-
Run the following command to edit the add-ons file:
Set the rest value to enabled: true. The edited file should look like the following example:oc edit db2ucluster deployment_ID
addOns: rest: enabled: true
-
Run the following command to view the REST service and deployment information:
The results should look similar to the following example: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
service c-db2wh-1603819662989-db2u-rest-svc Creating Deployment c-db2wh-1603819662989-rest Creating
-
Run the following command to view the REST pod as part of your deployment:
Here is an example with the REST pod highlighted:oc get pods |grep db2
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.