Configure DB2 REST component on Openshift

Enabling and initializing DB2 provided REST component


Author(s): Tamas Bures | Created: 16 July 2020 | Last modified: 16 July 2020
Tested on: Red Hat OpenShift Platform v 4.3.24 & IBM DB2 11.5.4

Configure DB2 REST component on Openshift

In this guide, I will demonstrate how to enable DB2 REST component and create the initial configuration.

Prerequisites

  1. An installed DB2 on Openshift with rest.enabled="true" in helm_options file. See this guide for more details.

  2. An already created database (TEST in my environment).

Configuration

  1. Open a shell to the POD where the REST component is created either by using OCP console or command line. The POD name usually in this form: <RELEASE_NAME>-db2u-rest-<random numbers and letters>.

  2. Stop the REST component with the following command:

     /opt/ibm/dbrest/scripts/db2rest-stop.sh

    Example output:

     Stopping the Db2 REST server...
     SERVER STATUS: INACTIVE
  3. Create the initial config with the following command:

     /opt/ibm/dbrest/scripts/db2rest-setup.sh <HOSTNAME> <DB> \ 
     <DB_PORT> <SSL> <SCHEMA NAME> <DB2 USER> <DB2 USER PASSWORD>

    Where:

    • HOSTNAME is the publicly availabl hostname where DB2 listens (in my case, it is an exposed NodePort through load balaner)
    • DB the created database (TEST in my case)
    • PORT where DB2 listens (default is 50000)
    • SSL Y/N
    • SCHEMA NAME where the tool creates the required tables
    • DB2 USER the user who can connect to the database (default is db2inst1)
    • DB2 USER PASSWORD password of the user

    Example command:

     /opt/ibm/dbrest/scripts/db2rest-setup.sh db2u-rest.ocp.sechu.ibm TEST 50000 N DB2REST db2inst1 password

    Example output:

     Creating REST Services metadata...
     REST Services metadata created in schema DB2REST.
  4. Start the REST component with the following command:

     /opt/ibm/dbrest/scripts/db2rest-start.sh

    Example output:

     Starting the Db2 REST server...
     SERVER STATUS: ACTIVE