You can choose a custom external database for your ODM Kubernetes release.
About this task
ODM for production supports database connections to custom external databases, for example Oracle
databases. In this case, the customer is responsible for the backup and recovery process.
To use a custom external database, configure the externalCustomDatabase
parameters.
externalCustomDatabase.datasourceRef
: data source secret for both Decision
Center and Decision Server data source files.
externalCustomDatabase.driverPvc
: Persistent Volume Claim to access the JDBC
database driver.
Procedure
-
Create an XML file to configure the Decision Center data source.
Name the file datasource-dc.xml.
The following example shows a configuration file for Oracle.
<server>
<!-- Declare the jar files for Oracle access through JDBC. -->
<library id="OracleLib">
<fileset dir="/drivers" includes="ojdbc*.jar"/>
</library>
<!-- Declare the database -->
<dataSource jndiName="jdbc/ilogDataSource"
isolationLevel="TRANSACTION_READ_COMMITTED"
statementCacheSize="150">
<connectionManager maxPoolSize="25"
minPoolSize="10"
connectionTimout="10s"
agedTimeout="30m"/>
<jdbcDriver libraryRef="OracleLib"/>
<properties.oracle driverType="thin"
databaseName="xe"
serverName="oracleServerName"
portNumber="1521"
user="system"
password="oracle"/>
</dataSource>
</server>
Note: The
/drivers path must not be modified. The path locates a directory in
the container. To copy a driver to the
/drivers directory, use the following
command.
kubectl cp ojdbc8-12.x.x.x.jar namespace/odm-release-name-odm-decisioncenter-XXXXXX:/drivers/
-
Create an XML file to configure the Decision Server data source.
Name the file datasource-ds.xml.
The following example shows a configuration file for Oracle.
<server>
<!-- Declare the jar files for Oracle access through JDBC. -->
<library id="OracleLib">
<fileset dir="/drivers" includes="ojdbc*.jar"/>
</library>
<!-- Declare the database -->
<dataSource jndiName="jdbc/resdatasource">
<jdbcDriver libraryRef="OracleLib"/>
<properties.oracle driverType="thin"
databaseName="xe"
serverName="oracleServerName"
portNumber="1521"
user="system"
password="oracle"/>
</dataSource>
</server>
-
Create a secret from the two XML files.
Use the
kubectl create secret
command to create a secret. The following
example creates the secret
customdatasource-secret.
kubectl create secret generic customdatasource-secret --from-file datasource-ds.xml --from-file datasource-dc.xml
-
Create a Persistent Volume Claim (PVC) to host the JDBC Oracle driver.
The following YAML file (
driver-pvc.yaml) defines the PVC
customdatasource-pvc.
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: customdatasource-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
The following command creates the
PVC.
kubectl create -f driver-pvc.yaml
-
When you install a new Operational Decision Manager release,
use the custom parameters for the secret and PVC you created.
externalCustomDatabase.datasourceRef=customdatasource-secret
externalCustomDatabase.driverPvc=customdatasource-pvc
-
Push the JDBC driver in the PVC by running a
kubectl cp
command.
- Get the name of the pod for the ODM helm release by using the command
kubectl get pods |
grep odm-release-name
. The command returns a list of pods.
- Check that the Oracle database is up and running.
- Add the Oracle JDBC driver to a pod with the following
command.
kubectl cp ojdbc8-12.x.x.x.jar namespace/odm-release-name-odm-decisioncenter-XXXXXX:/drivers/
-
Restart all the pods by using the
kubectl delete pod
command.
kubectl delete pod odm-release-name-odm-decisioncenter-XXXXXX \
kubectl delete pod odm-release-name-odm-decisionserverconsole-XXXXXX \
kubectl delete pod odm-release-name-odm-decisionserverruntime-XXXXXX \
kubectl delete pod odm-release-name-odm-decisionrunner-XXXXXX