Configure DB2 REST component on Openshift
In this guide, I will demonstrate how to enable DB2 REST component and create the initial configuration.
Prerequisites
An installed DB2 on Openshift with
rest.enabled="true"inhelm_optionsfile. See this guide for more details.An already created database (
TESTin my environment).
Configuration
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>.Stop the REST component with the following command:
/opt/ibm/dbrest/scripts/db2rest-stop.shExample output:
Stopping the Db2 REST server... SERVER STATUS: INACTIVECreate 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:
HOSTNAMEis the publicly availabl hostname where DB2 listens (in my case, it is an exposed NodePort through load balaner)DBthe created database (TESTin my case)PORTwhere DB2 listens (default is50000)SSLY/NSCHEMA NAMEwhere the tool creates the required tablesDB2 USERthe user who can connect to the database (default isdb2inst1)DB2 USER PASSWORDpassword of the user
Example command:
/opt/ibm/dbrest/scripts/db2rest-setup.sh db2u-rest.ocp.sechu.ibm TEST 50000 N DB2REST db2inst1 passwordExample output:
Creating REST Services metadata... REST Services metadata created in schema DB2REST.Start the REST component with the following command:
/opt/ibm/dbrest/scripts/db2rest-start.shExample output:
Starting the Db2 REST server... SERVER STATUS: ACTIVE