Using an external database for Managed services
You can configure Managed services to use an external MongoDB. This configuration is optional.
External MongoDB connection
The supported version for external MongoDB is 4.2.x.
Steps to connect an external MongoDB connection:
-
Back up
cam_cr.yaml
.oc get manageservice cam -o yaml > cam_cr.yaml
-
Open the
cam_cr.yaml
and edit the following properties.global: externalDb: <true | false > externalDbConfig: < external DB config in base 64 > externalMongoDBCertificate: <CA certificate in base 64 > mongoDbUrl: <mongodburl in base 64 >
-
externalDb: Set this value to true.
-
externalDbConfig: Add base64 encode for extra configuration. This is added as an object and contain all the options that require to connect the mongo connection.
-
Sample configuration:
{ "ssl":true, "sslValidate":false, "cert":"/usr/src/app/dbcerts/external_db_ca.crt" }
Note: Add certificate key along with the path of certificate.
"cert":"/usr/src/app/dbcerts/external_db_ca.crt"
is a required key value pair in the configuration object.-
externalMongoDBCertificate: base64 encode of the certificate.
-
mongoDbUrl: External database url.
Note: Some of the mongo instance may use only url and need not require any certificate. In such case, update externalDb and mongoDbUrl.
-
-
Save your changes.
-
After the above changes in
cam_cr.yaml
, delete thecam_cr
.oc delete manageservices cam
-
Open new terminal and run the following command to delete the finalizer.
oc edit manageservices cam
finalizers: - helm.sdk.operatorframework.io/uninstall-release
-
Once the finalizer is deleted, your
cam_cr.yaml
will also be deleted. To recreate with editedcam_cr.yaml
file, follow the below command.oc apply -f cam_cr.yaml
-
All the pods are deleted and newly created pods points to the external MongoDB connection.
Disconnection of external MongoDB and reconnect to the cam-mongo pods
Steps to disconnect from an external MongoDB connection and reconnect to the cam-mongo pods:
-
Back up
cam_cr.yaml
. -
Open the
cam_cr.yaml
and set the externalDb to false.global: externalDb: false
-
Save your changes.
-
After the above changes in
cam_cr.yaml
, delete thecam_cr.yaml
.oc delete manageservices cam
-
Open new terminal and run the following command to delete the finalizer.
oc edit manageservices cam
finalizers: - helm.sdk.operatorframework.io/uninstall-release
-
All the pods are deleted and newly created pods points to the cam-mongo pods.