# Set Up a MariaDB Cluster

## Prerequisites

* Before setting up a database, ensure that you are working within a provisioned [<mark style="color:blue;">Virtual Data Center (VDC)</mark>](https://docs.ionos.com/cloud/support/general-information/glossary-of-terms#virtual-data-center-vdc) that contains at least one VM from which to access the database. The VM you create is counted against the quota allocated in your contract.
* Database Manager is available only for contract administrators, owners, and users with **Access and manage DBaaS** privileges. You can set the privilege via the DCD group privileges. For more information, see [<mark style="color:blue;">Manage User Access</mark>](https://docs.ionos.com/sections-test/guides/set-up-ionos-cloud/management/identity-access-management/user-management).

## Create a Cluster

To create a MariaDB cluster, follow these steps:

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

2\. Click **Create cluster** to create a new MariaDB cluster.

3\. Enter the following details in the **Create cluster** window:

* [<mark style="color:blue;">Define cluster properties</mark>](#define-cluster-properties)
* [<mark style="color:blue;">Select the required number of resources</mark>](#select-the-required-number-of-resources)
* [<mark style="color:blue;">Connect the data center with the MariaDB cluster</mark>](#connect-the-data-center-with-the-mariadb-cluster)
* [<mark style="color:blue;">Schedule the MariaDB cluster maintenance</mark>](#schedule-the-mariadb-cluster-maintenance)
* [<mark style="color:blue;">Define users</mark>](#define-users)

**Result:** The **Estimated costs** will be displayed based on the input. It is exclusive and certain variables like traffic and backup are not considered.

!\[Estimated costs]\(../../../images/mariadb/MariaDB-estimated-costs.png)

4\. Click **Save** to create the MariaDB cluster.

{% hint style="success" %}
**Result:** Your MariaDB Cluster is now created. The **STATE** is set to **CREATING** when the operation is in progress.
{% endhint %}

![MariaDB cluster is being created](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-a6423757ce2bf20c190d8a4ad958a1ab68c53ed0%2FmariaDB-successful-creation.png?alt=media)

## Define Cluster properties

To define cluster properties, specify the following:

1. **Cluster Name:** Enter an appropriate name for your MariaDB cluster.
2. **Cluster Version:** Select a version of MariaDB from the drop-down list. IONOS Cloud only supports *Long-Term Support (LTS) versions*, starting from MariaDB 10.6.
3. **Instances:** Enter the number of MariaDB nodes you want in the cluster. One MariaDB node always manages the data of exactly one database cluster. You can also use the arrows to increase or decrease the number of nodes. Replication is possible only when you define more than one node.

**Note:** Here, you will have a **primary** node and one or more standby nodes that run a copy of the active database, so you have **n-1 standby** nodes in the cluster.

4\. \*\*Location:\*\* Select a location of your preference from the drop-down list.

5. **Replication Type:** The replication type is **Asynchronous** by default for MariaDB. You will see this option only upon selecting more than one node (instance). In an asynchronous mode, the primary MariaDB node does not wait for a replica to indicate that the data has been written. The cluster can lose some committed transactions to ensure availability.
6. **CPU Type:** The CPU type is set to **Dedicated Core**, by default.

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

## Select the required number of resources

To select the number of resources that you want to associate with the MariaDB cluster, specify the following:

1. **Number of CPUs (per instance):** Increase or decrease the number of CPUs using the slider.
2. **RAM Size (per instance):** Increase or decrease the size of the RAM using the slider to suit your needs.
3. **Storage Type:** Currently, IONOS supports only [<mark style="color:blue;">SSD Premium</mark>](https://docs.ionos.com/cloud/support/general-information/glossary-of-terms#solid-state-drive-ssd), which is selected by default.
4. **Storage Size:** Enter the storage size, in Gigabytes (GB), either manually or use the arrows to increase or decrease the storage size accordingly based on your needs.

![Associate the required number of resources](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-01797af9335a24ebe0996df4a874116db960f13b%2Fmariadb-create-resources.png?alt=media)

## Connect the Data Center with the MariaDB Cluster

1. **Datacenter:** Select a data center from the drop-down list to associate it with the MariaDB cluster. The available data centers in the drop-down list vary according to the chosen **Location**. For more information, see [<mark style="color:blue;">Define cluster properties</mark>](#define-cluster-properties).
2. **Datacenter LAN:** Select a LAN from the drop-down list for the data center.
3. **IP/Subnet:** Enter the private IP or subnet using the available [<mark style="color:blue;">Private IPs</mark>](https://www.ionos.com/help/server-cloud-infrastructure/private-network/private-ip-address-ranges/).

{% 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 the respective NIC in the selected LAN. 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, you must discover the IP address on your own.
  {% endhint %}

![Connect the data center to the MariaDB cluster](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-adcf4478e8ffc5f7ec4915161190eeb156c24909%2Fmariadb-associate-datacenter.png?alt=media)

## Schedule the MariaDB Cluster maintenance

The selection of **Mainatenance period** is optional. Your chosen start time (UTC) plus four hours is the maintenance time.

1. **Day:** Select a day from the drop-down list to set a day for maintenance.
2. **Start Time (UTC):** Enter a time using the pre-defined format (hh:mm:ss) to schedule the maintenance task. You can also click the ![](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-78dc1fcfac8420a5b5d3dfe8bf77fb4efc818bd7%2Fmariadb-dcd-clock-icon.png?alt=media) icon to set a time.

**Note:** We recommend choosing the day and time appropriately because the maintenance occurs in a **4-hour-long window**.

![Schedule maintenance](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-a8a178884600fb4bb97af569a1b21f97dcd94cf6%2Fmariadb-schedule-maintenance.png?alt=media)

## Define Users

The credentials of any user who has previously been created in the backup will be overwritten.

1. **Username:** Enter a username to provide access to the MariaDB cluster for the respective user.
2. **Password:** Enter a password for the respective user.

![Define user](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-35b14718b2ed8b340c82421e4e5ef4ea5dd566e5%2Fmariadb-define-user.png?alt=media)
