Skip to main content

Your submission was sent successfully! Close

Thank you for signing up for our newsletter!
In these regular emails you will find the latest updates from Canonical and upcoming events where you can meet our team.Close

Thank you for contacting us. A member of our team will be in touch shortly. Close

How to manage client connections

Integrations (formerly “relations”) are connections between two applications with compatible endpoints. These connections simplify the creation and management of users, passwords, and other shared data.

Summary


Create a client connection to a bare replica set

To create a client connection to a replica set, simply integrate your client application with a Charmed MongoDB application running in replication mode.

If you do not have a client application that implements this interface, you can use the data-integrator charm.

To integrate mongodb with a client application, run:

juju integrate mongodb-k8s <application>

Remove a client connection to a replica set

To remove a client connection and the user associated with it:

juju remove-relation mongodb-k8s <application>

Rotate the client password

To rotate the replica-set client password, the integration should be removed and integrated again:

juju remove-relation <application> mongodb-k8s
juju integrate <application> mongodb-k8s

This process will generate a new user and password for the application.

Create a client connection to a sharded cluster

To create a client connection to a sharded cluster, you must use the Charmed Mongos-K8s router.

To deploy mongos-k8s and data-integrator, run:

juju deploy mongos-k8s
juju deploy data-integrator [necessary options]

Wait for mongos-k8s’s status to be idle, then integrate it with data-integrator:

juju integrate mongos-k8s data-integrator

Next, integrate the mongos-k8s charm to a Charmed MongoDB application running as a config-server:

juju integrate config-server mongos-k8s

Remove a client connection to a sharded cluster

To remove a client connection to a sharded cluster:

juju remove-relation config-server mongos-k8s

Rotate the mongos-k8s client password

To rotate client passwords, the integration should be removed and integrated again:

juju remove-relation <application> mongos-k8s
juju integrate <application> mongos-k8s

This process will generate a new user and password for the application.

Then to connect to the sharded MongoDB k8s cluster outside of juju, set the configuration expose-external on the Mongos-k8s Charm.

 juju config mongos-k8s expose-external=nodeport

This will make the mongos router accessible outside of juju and will provide you access to the cluster. You will now see that all of your client URIs have been updated.

For example run:

juju run data-integrator get-credentials

and see that the URI as changed.

To reconfigure the charm to have internal access only run:

 juju config mongos-k8s expose-external=none

Internal operator user

The operator (i.e. admin) user is used internally by Charmed MongoDB K8s. To rotate its password, use the set-password action.

To set a specific password for the operator user, run:

juju run mongodb-k8s/leader set-password password=<password>

To randomly generate a password for the operator user, run:

juju run mongodb-k8s/leader set-password

Last updated 30 days ago. Help improve this document in the forum.