# Set Up a MongoDB Cluster

You can add a MongoDB cluster on any of the following editions: **Playground**, **Business**, or **Enterprise**.

## Create a Cluster

{% hint style="info" %}
**Prerequisites:** Before setting up a database, make sure you are working within a provisioned [<mark style="color:blue;">VDC</mark>](https://docs.ionos.com/cloud/support/general-information/glossary-of-terms#vdc) that contains at least one virtual machine ([<mark style="color:blue;">VM</mark>](https://docs.ionos.com/cloud/support/general-information/glossary-of-terms#vm)) from which to access the database. The VM you create is counted against the quota allocated in your contract. For more information on databases quota, see [<mark style="color:blue;">Resource Allocation</mark>](https://docs.ionos.com/sections-test/guides/databases/mongodb/overview/resource-allocation).
{% endhint %}

{% hint style="info" %}
**Note:** Database Manager is available for contract administrators, owners, and users with **Access and manage DBaaS** privileges only. You can set the privilege via the DCD group privileges.
{% endhint %}

To create a MongoDB cluster, follow these steps:

1\. In the **DCD**, go to **Menu** > **Databases** > **MongoDB**.

{% hint style="info" %}
**Info:** The **Resource allocation** section displays the resources allotted to your contract and the number of used and unused resources if you have already created MongoDB clusters.
{% endhint %}

![Number of used and unused resources](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-bff9d548a79d63ce87c81835771dee1e0dc3e3ec%2Fmongodb-resource-allocation.png?alt=media)

2\. In the **MongoDB cluster overview** window, click **Create cluster** to create a new MongoDB cluster.

3\. Specify the following in the **Properties** section:

* Provide an appropriate **Cluster Name**.
* From the drop-down list, choose a **Location** where your data for the database cluster can be stored. You can select an available data center within the cluster's data directory to create your cluster.
* Select the appropriate **MongoDB Version**. The IONOS Cloud Database Manager supports MongoDB versions 6.0 and 7.0.

![Define cluster properties](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-f02adf53e4b004591bcf1bf30f5c3aa3f536ea03%2Fmongodb-create-properties.png?alt=media)

4\. Choose an **Edition**.

{% tabs %}
{% tab title="Playground" %}
In the **Playground** edition, the following standard resources are available:

* **RAM Size (GB):** 2.
* **vCPU:** 1.
* **Storage Size:** 50 GB.

{% hint style="info" %}
**Note:** You can create one playground instance for free and test MongoDB. For every additional instance that you create apart from the first instance, the charges are applicable accordingly.
{% endhint %}

![Selecting a Playground edition](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-094f119d8c924e9bdb8f8962034df3d4bee23365%2Fmongodb-create-playground-edition.png?alt=media)
{% endtab %}

{% tab title="Business" %}
In the **Business** edition, select a relevant **Template** to based on the resources required for creating your MongoDB cluster. The resources vary for each of the predefined templates based on the **RAM Size (GB)**, **vCPU**, and **Storage Size**. Select a template from the drop-down list that suits your needs.

{% hint style="info" %}
**Note:** Depending on the resource limit allocation as per your contract, some of the templates may not be available for selection.
{% endhint %}

![Selecting a Business edition](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-464aacc2bc0ede7b19359783d15b0c8731211fe7%2Fmongodb-create-business-edition.png?alt=media)
{% endtab %}

{% tab title="Enterprise" %}
In the **Enterprise** edition, choose the following resources for creating each node of your MongoDB cluster. The total billed resources will be these values multiplied by the number of instances and the number of shards (if applicable).

![Selecting an Enterprise edition](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-344596f0b9a5130cde8b91ffc075eac40f4d6eac%2Fmongodb-create-enterprise-edition.png?alt=media)
{% endtab %}
{% endtabs %}

5\. Configure your cluster in the **Cluster configuration** section.

{% tabs %}
{% tab title="Playground" %}

* **Database type:** It is set to **Replica Set**, by default. This database type maintains replicas of data sets and offers redundancy and high data availability.

{% hint style="info" %}
**Note:** The **Sharded Cluster** database type is not available for selection in the **Playground** edition.
{% endhint %}

* **Instances:** By default, one instance is offered for free in this edition to host a logical database manager environment to catalog your databases.

![Cluster configuration for MongoDB Playground edition](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-cf6ce38404ab2b2404f6ef45040866164784f492%2Fmongodb-create-pg-cluster-config.png?alt=media)
{% endtab %}

{% tab title="Business" %}

* **Database type:** It is set to **Replica Set**, by default. This database type maintains replicas of data sets and offers redundancy and high data availability.

**Note:** The Sharded Cluster database type is not available for selection in the **Business** edition.

* **Instances:** Select a value from the drop-down list to host a logical database manager environment to catalog your databases. By default, one instance and three instances are possible in the Business edition.

![Cluster configuration for MongoDB Business edition](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-5a0c3c5b2276a64074868cd19d90dd6ba9e22b8d%2Fmongodb-create-business-cluster-config.png?alt=media)
{% endtab %}

{% tab title="Enterprise" %}

* **Database type:** Select the **Database type** from the following:
* **Replica Set:** Maintains replicas of datasets; offers redundancy and high availability of data.
* **Sharded Cluster:** Maintains collection of datasets that are distributed across many shards (servers) and hence offers horizontal scalability.

{% hint style="info" %}
**Note:** For sharded clusters, an additional three **config server** instances are created with sizing of two cores, 4 GB of memory, and 40 GB of storage each. These instances are excluded from the billed resources.
{% endhint %}

* **Amount of shards:** Define the **Amount of shards** between two to a maximum of thirty-two shards. This is applicable to **Sharded Cluster** only.
* **Instances:** Select the number of instances to host a logical database manager environment to catalog your databases. By default, three instances are possible in the **Enterprise** edition.
* **Backup Location:** Select a backup location that is explicitly the location of your backup (region). You can have off-site backups by using a region that is not included in your database region.
* **BI Connector enabled:** Toggle to enable the MongoDB Connector for Business Intelligence (BI) to query a MongoDB database by using SQL commands to aid in the data analysis. If you do not want to use BI Connector, you can toggle off this setting.

![Cluster configuration for MongoDB Enterprise edition](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-4d906b3bf51f47f495c3159ea194621d52ce288d%2Fmongodb-create-enterprise-cluster-config.png?alt=media)
{% endtab %}
{% endtabs %}

6\. Upon selecting **Enterprise** edition, you can choose from the following in the **Resources** section.

{% hint style="info" %}
**Info:** The **Resources** selection is applicable only for **Enterprise** edition. For **Playground**, and **Business** edition, continue with step 7.
{% endhint %}

* **Number of CPUs (per instance):** You can choose between 1 and 31 CPU cores using the slider or choose from the available shortcut values.
* **RAM Size (per instance):** Values of up to 230 GB RAM sizes are possible. Select the RAM size using the slider or choose from the available shortcut values.
* **Storage Type:** The **SSD Premium**, [<mark style="color:blue;">SSD Standard</mark>](https://docs.ionos.com/cloud/support/general-information/glossary-of-terms#ssd), or [<mark style="color:blue;">HDD</mark>](https://docs.ionos.com/cloud/support/general-information/glossary-of-terms#hdd) storage options are available.
* **Storage Size:** Set the storage size value to at least 100 GB in case of SSD Standard and Premium storage types for optimal performance of the database cluster. You can configure the storage size to a maximum of 4 TB.

![Selecting resources](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-ce450e97b43938c7c2ce4cf2c33b8c32fb527c7a%2Fmongodb-create-enterprise-edition-resources.png?alt=media)

7\. In the **Network configuration** section, set up the following:

{% hint style="info" %}
**Prerequisite:** Make sure you have a data center configured with a dedicated private LAN available. To do so, [<mark style="color:blue;">Create a Data Center</mark>](https://docs.ionos.com/sections-test/guides/set-up-ionos-cloud/get-started/create-data-center), [<mark style="color:blue;">Configure the data center</mark>](https://docs.ionos.com/sections-test/guides/set-up-ionos-cloud/get-started/configure-data-center) and [<mark style="color:blue;">Configure a private LAN</mark>](https://docs.ionos.com/sections-test/guides/set-up-ionos-cloud/get-started/configure-data-center#configure-a-private-lan).
{% endhint %}

1. **Datacenter:** Select a data center from the drop-down list.
2. **Datacenter LAN:** Select a LAN for the chosen data center. The drop-down list shows all the available private LANs.
3. **IP/Subnet:** Enter the private IP or subnet address in the correct format by using the available Private IPs. For **Business** and **Enterprise** editions, specify one private IP/Subnet address detail for every instance based on the chosen number of **Instances**.

{% hint style="info" %}
**Note:** To know your private IP address/Subnet, you need to:

* Create a single server connected to an empty private LAN and check the IP assigned to that NIC in that LAN or retrieve the subnet assigned to the LAN using the `ipv4CidrBlock` property of the API call [<mark style="color:blue;">Retrieve LANs/mark></mark>](https://api.ionos.com/docs/cloud/v6/#tag/LANs/operation/datacentersLansFindById). The DHCP in that LAN always uses a /24 subnet, so you must reuse the first 3 octets to reach your database.
* To prevent a collision with the DHCP IP range, it is recommended to use IP addresses ending between x.x.x.3/24 and x.x.x.10/24 (which are never assigned by DHCP).
* If you have disabled DHCP on your private LAN, then you need to discover the IP address on your own.
  {% endhint %}

![MongoDB cluster to data center connection](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-802f499e44e5936ae97e022a83ff92b77e2b8fde%2Fmongodb-create-network-confirm.png?alt=media)

8\. In the **Maintenance period (optional) section**, set the following:

* **Day:** From the drop-down list, choose the preferred day on which the maintenance of the cluster must take place.
* **Start Time (UTC):** Set the time (in UTC) for the maintenance of the MongoDB cluster. Use the pre-defined format (hh:mm:ss) or you can use the clock. The maintenance occurs in a 4-hour-long window.

![MongoDB cluster maintenance window](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-07efe2aedfaba88ad8ccde0e6a756b0ee2dcc1fb%2Fmongodb-cluster-create-maintenance-window.png?alt=media)

9\. Click **Save** to provision the creation of the MongoDB cluster.

{% hint style="info" %}
**Note:** The **Estimated price** will be displayed based on the input. The estimated cost is exclusive, where certain variables like traffic and backup are not considered.
{% endhint %}

{% hint style="success" %}
\*\*Result:\*\* The MongoDB cluster with the chosen edition is created.
{% endhint %}

![MongoDB cluster is in creation](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-1d139bf241f086df9ea3c03b87248df200f22ffb%2Fmongodb-cluster-create-success.png?alt=media)
