MongoDB
- Canonical
- Databases
Channel | Revision | Published | Runs on |
---|---|---|---|
6/stable | 199 | 04 Oct 2024 | |
6/candidate | 199 | 04 Oct 2024 | |
6/beta | 199 | 04 Oct 2024 | |
6/edge | 202 | 16 Oct 2024 | |
5/stable | 117 | 20 Apr 2023 | |
5/candidate | 117 | 20 Apr 2023 | |
5/edge | 139 | 21 Nov 2023 | |
5/edge | 109 | 06 Mar 2023 | |
3.6/stable | 100 | 28 Apr 2023 | |
3.6/candidate | 100 | 13 Apr 2023 | |
3.6/edge | 100 | 03 Feb 2023 |
juju deploy mongodb --channel 6/stable
Deploy universal operators easily with Juju, the Universal Operator Lifecycle Manager.
Platform:
How to deploy Charmed MongoDB
This is a guide on how to deploy Charmed MongoDB as a replica set or a sharded cluster.
Summary
Create a MongoDB replica set
You can create one or multiple replicas at once when deploying MongoDB.
Deploy a single replica
To deploy a single unit of MongoDB as a replica set, run:
juju deploy mongodb
This will deploy the latest stable release . To specify a different version, use the
--channel
flag, e.g.--channel=6/beta
.
Deploy multiple replicas
To deploy MongoDB with multiple replicas, specify the number of desired replicas with the -n
option:
juju deploy mongodb -n <number_of_replicas>
Create a MongoDB sharded cluster
To create a sharded cluster, we must first deploy each cluster component separately with a manually defined role, then integrate them.
Deploy cluster components with a single replica
Deploying a shard application will assign it one replica by default.
To deploy a sharded cluster with two shards, run:
juju deploy mongodb --config role="config-server" <config_server_name>
juju deploy mongodb --config role="shard" <shard_name_0>
juju deploy mongodb --config role="shard" <shard_name_1>
This will deploy the latest stable release . To specify a different version, use the
--channel
flag, e.g.--channel=6/beta
.
Deploy cluster components with multiple replicas
To configure the amount of replicas for a shard or config-server during deployment, just use the -n
flag.
To deploy a shard and config-server with 3 replicas each, run:
juju deploy mongodb --config role="shard" <shard_name> -n 3
juju deploy mongodb --config role="config-server" <config_server_name> -n 3
This will deploy the latest stable release . To specify a different version, use the
--channel
flag, e.g.--channel=6/beta
.
Note that you can also change the number of replicas for a shard or config server after deployment. See How to scale > Add shards to a cluster.
Integrate cluster components
To create a cluster, integrate the shard applications with the config-server application.
For the case of two shards and one config server, you would run:
juju integrate config-server:config-server <shard_name_0>:sharding
juju integrate config-server:config-server <shard_name_1>:sharding