Configuring a Db2 HA external database
You can configure your Operational Decision Manager instance to connect to a Db2® database server in High Availability (HA) mode.
About this task
Operational Decision Manager supports High Availability connections to Db2.
To configure a Db2 server in HA, you need to create a data source secret. You must then set the externalCustomDatabase parameters in the odm_configuration
section of your custom resource file.
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 Db2 in HA.
The<server> <fileset id="DBLibFileset" dir="/config/resources" includes="*.jar" /> <library id="DBLib" filesetRef="DBLibFileset" /> <dataSource id="jdbc/ilogDataSource" jndiName="jdbc/ilogDataSource" isolationLevel="TRANSACTION_READ_COMMITTED" statementCacheSize="30"> <jdbcDriver libraryRef="DB2Lib" /> <properties.db2.jcc databaseName="ODMDB" serverName="mydbserver.mycompany.com" portNumber="50001" user="db2user" password="db2password" sslConnection="true" sslTrustStoreLocation="/config/security/truststore.jks" sslTrustStorePassword="<YOUR_TRUSTSTORE_PASSWORD>" clientRerouteAlternateServerName="alternatedbserver.mycompany.com" clientRerouteAlternatePortNumber="50001" maxRetriesForClientReroute="3" retryIntervalForClientReroute="15s" enableSeamlessFailover="1" /> <jdbcDriver javax.sql.ConnectionPoolDataSource="com.ibm.db2.jcc.DB2ConnectionPoolDataSource" libraryRef="DBLib" /> <connectionManager agedTimeout="120" connectionTimeout="30" maxIdleTime="90" maxPoolSize="50" minPoolSize="5" purgePolicy="FailingConnectionOnly" reapTime="60"/> </dataSource> </server>YOUR_TRUSTSTORE_PASSWORDvariable is the password that is stored in the secret referenced by theodm_configuration.dba.passwordSecretRefparameter in the CR. To maintain compatibility with the previous release, usechangeit, which was the default value. See the reference manual for more details. -
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 Db2 in HA.
<server> <fileset id="DBLibFileset" dir="/config/resources" includes="*.jar" /> <library id="DBLib" filesetRef="DBLibFileset" /> <dataSource id="jdbc/resdatasource" jndiName="jdbc/resdatasource" isolationLevel="TRANSACTION_READ_COMMITTED" statementCacheSize="30"> <jdbcDriver libraryRef="DB2Lib" /> <properties.db2.jcc databaseName="ODMDB" serverName="mydbserver.mycompany.com" portNumber="50001" user="db2inst1" password="Psiadmin1" sslConnection="true" sslTrustStoreLocation="/config/security/truststore.jks" sslTrustStorePassword="<YOUR_TRUSTSTORE_PASSWORD>" clientRerouteAlternateServerName="alternatedbserver.mycompany.com" clientRerouteAlternatePortNumber="50001" maxRetriesForClientReroute="3" retryIntervalForClientReroute="15s" enableSeamlessFailover="1" /> <jdbcDriver javax.sql.ConnectionPoolDataSource="com.ibm.db2.jcc.DB2ConnectionPoolDataSource" libraryRef="DBLib" /> <connectionManager agedTimeout="120" connectionTimeout="30" maxIdleTime="90" maxPoolSize="50" minPoolSize="5" purgePolicy="FailingConnectionOnly" reapTime="60"/> </dataSource> </server> -
Create a secret from the two XML files.
Use the
kubectl create secretcommand to create a secret. The following example creates customdatasource-secret.kubectl create secret generic customdatasource-secret --from-file datasource-ds.xml --from-file datasource-dc.xml -
Create a secret to store the certificate to connect to Db2. Use the
kubectl create secretcommand to create a secret. For example,kubectl create secret generic ibm-dba-odm-db2-cacert --from-file=tls.crt=./db2-ssl-cert.pemWhen you configure Operational Decision Manager, use the custom parameters for the secret that you created.
In a custom resource descriptor with the Cloud Pak operator, use the following YAML:
spec: odm_configuration: customization: trusted_certificate_list: - ibm-dba-odm-db2-cacert externalCustomDatabase: datasourceRef: customdatasource-secret