arrow-left

All pages
1 of 13

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Retrieve all Backups of a MariaDB Cluster

You can retrieve all backups of a specific MariaDB cluster using its clusterId. Specify a limit to limit the maximum number of elements returned and define pagination using offset.

hashtag
Request

curl -X 'GET' \
  'https://mariadb.de-txl.ionos.com/clusters/{clusterId}/backups' \
  -H 'accept: application/json'
circle-info

Note: Remember to replace the clusterId with a valid ID.

hashtag
Response

200 Successful operation

{
  "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
  "items": [
    {
      "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
      "properties": {
        "clusterId": "498ae72f-411f-11eb-9d07-046c59cc737e",
        "earliestRecoveryTargetTime": "2021-10-23T01:21:10Z",
        "size": 2052,
        "baseBackups": [
          {
            "created": "2020-12-10T13:37:50+01:00",
            "size": 543
          }
        ]
      }
    }
  ],
  "offset": 200,
  "limit": 100,
  "total": 200,
  "_links": {
    "prev": "<PREVIOUS-PAGE-URI>",
    "self": "<THIS-PAGE-URI>",
    "next": "<NEXT-PAGE-URI>"
  }
}

Prerequisites

Follow the network specifications and resource considerations listed on this page to successfully set up a MariaDB cluster.

hashtag
Network configuration

To set up a database inside an existing data center, you should have at least one server in a private LAN. You need to choose an IP address, under which the database leader should be made available.

There is currently no IP address management for databases. If you use your subnet, you may use any IP address in that corresponding subnet. You must choose the IP address of the subnet that IONOS Cloud assigns you if your servers use DHCP. The IP address of the subnet can be found in your NIC configuration.

hashtag
Resource considerations

CPU, RAM, storage, and number of database clusters are counted against quotas. Database performance depends on the storage type. Currently, IONOS Cloud supports only storage type, by default.

The are stored alongside the database. The amount of files can grow and shrink depending on your workload. For a reasonable performance, we recommend that you set the SSD's storage size to at least 100 GB.

hashtag
Database backups

All database clusters are backed up automatically. For more information, see .

Restore a MariaDB Cluster from a Backup

The request restores a MariaDB cluster from a backup.

hashtag
Prerequisites

The backup must:

  • belong to the MariaDB cluster to be restored.

  • be in the AVAILABLE state.

hashtag
Request

circle-info

Info: The sample UUID in the example is 498ae72f-411f-11eb-9d07-046c59cc737e.

hashtag
Response

You will receive a 202 Successful operation when the request is complete.

List MariaDB Cluster Backups

You can retrieve a list of backups for all MariaDB clusters in your contract. You can specify an integer for limit to return the maximum number of elements and define the pagination using offset.

hashtag
Request

SSD Premiumarrow-up-right
binary log filesarrow-up-right
Automatic backups
hashtag
Response

200 Successful operation

curl -X 'GET' \
  'https://mariadb.de-txl.ionos.com/backups?limit=100&offset=200' \
  -H 'accept: application/json'
{
  "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
  "items": [
    {
      "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
      "properties": {
        "clusterId": "498ae72f-411f-11eb-9d07-046c59cc737e",
        "earliestRecoveryTargetTime": "2021-10-23T01:21:10Z",
        "size": 2052,
        "baseBackups": [
          {
            "created": "2020-12-10T13:37:50+01:00",
            "size": 543
          }
        ]
      }
    }
  ],
  "offset": 200,
  "limit": 100,
  "total": 200,
  "_links": {
    "prev": "<PREVIOUS-PAGE-URI>",
    "self": "<THIS-PAGE-URI>",
    "next": "<NEXT-PAGE-URI>"
  }
}
curl -X 'POST' \
  'https://mariadb.de-txl.ionos.com/clusters/{clusterId}/restore' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
      "backupId": "498axce2f-411f-11eb-9d07-046c80cc737e",
      "recoveryTargetTime": "2020-12-10T13:37:50+01:00"
}'

Fetch a MariaDB Cluster

You can retrieve a MariaDB cluster using its UUID. It is found in the response body when a MariaDB cluster is created or when you retrieve a list of MariaDB clusters using GET.

hashtag
Request

To query a single cluster, you need the id from your create response.

circle-info

Note:

  • Remember to update your UUID. The sample UUID in the example is 498ae72f-411f-11eb-9d07-046c59cc737e.

hashtag
Response

202 Successful operation

Fetch a specific Backup of a MariaDB Cluster

You can retrieve a specific backup of a MariaDB cluster using its ID. You can find the ID when you the list of all MariaDB cluster backups. You can specify an integer for limit to return the maximum number of elements and define the pagination using offset.

hashtag
Request

Your cluster runs in the default port 3306 and you cannot modify or configure it.

curl -X 'GET' \
  'https://mariadb.de-txl.ionos.com/clusters/498ae72f-411f-11eb-9d07-046c59cc737e' \
  -H 'accept: application/json'
circle-info

Note: Remember to replace the backupId with a valid ID.

hashtag
Response

200 Successful operation

curl -X 'GET' \
  'https://mariadb.de-txl.ionos.com/backups/{backupId}' \
  -H 'accept: application/json'
retrieve
{
  "type": "cluster",
  "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
  "metadata": {
    "createdDate": "2020-12-10T13:37:50+01:00",
    "createdBy": "[email protected]",
    "createdByUserId": "87f9a82e-b28d-49ed-9d04-fba2c0459cd3",
    "lastModifiedDate": "2020-12-11T13:37:50+01:00",
    "lastModifiedBy": "[email protected]",
    "lastModifiedByUserId": "87f9a82e-b28d-49ed-9d04-fba2c0459cd3",
    "state": "AVAILABLE"
  },
  "properties": {
    "displayName": "MariaDB cluster",
    "mariadbVersion": "10.6",
    "dnsName": "ma-yourcluster.mariadb.region.ionos.com",
    "instances": 2,
    "ram": 2,
    "cores": 4,
    "storageSize": 10,
    "connections": [
      {
        "datacenterId": "5a029f4a-72e5-11ec-90d6-0242ac120003",
        "lanId": "2",
        "cidr": "192.168.1.100/24"
      }
    ],
    "maintenanceWindow": {
      "time": "16:30:59",
      "dayOfTheWeek": "Monday"
    }
  }
}
{
  "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
  "properties": {
    "clusterId": "498ae72f-411f-11eb-9d07-046c59cc737e",
    "earliestRecoveryTargetTime": "2021-10-23T01:21:10Z",
    "size": 2052,
    "baseBackups": [
      {
        "created": "2020-12-10T13:37:50+01:00",
        "size": 543
      }
    ]
  }
}

Create a MariaDB Cluster

The request creates a new MariaDB cluster.

hashtag
Prerequisite

  • Only contract administrators, owners, and users with Access and manage DBaaS privilege can create and manage MariaDB clusters. Ensure that you have the necessary privilege.

hashtag
Request

circle-info

Note:

  • After creating a MariaDB cluster, you can access it via the corresponding LAN using the same username and password specified during creation.

  • This is the only opportunity to set the username and password

hashtag
Response

Your values will differ from those in the sample code. It may contain different IDs, timestamps etc.

You may have noticed that the metadata.state is BUSY and that the database is not yet reachable. This is because the cloud will create a completely new cluster and needs to provision new nodes for all the requested replicas. This process runs asynchronously in the background and might take up to 30 minutes.

200 Successful operation

After creation, remember to validate the status of your MariaDB cluster. For more information, see .

Delete a MariaDB Cluster

You can delete a MariaDB cluster using its UUID. The response body will provide details about the cluster's UUID once a MariaDB cluster has been created or when obtaining a list of clusters.

hashtag
Request

circle-info

Note: Remember to update your UUID. The sample UUID in the example is 498ae72f-411f-11eb-9d07-046c59cc737e.

hashtag
Response

202 Successful operation

Connect from Kubernetes

This topic describes connecting to MariaDB from your managed Kubernetes cluster.

hashtag
Prerequisites

Ensure that the following are available before connecting to the database:

  • A datacenter with the following id: xyz-my-datacenter.

  • A private LAN with id 3 using the network 10.1.1.0/24.

  • A database connected to LAN 3 with the following IP address: 10.1.1.5/24.

  • A Kubernetes cluster with the following id: xyz-my-cluster.

hashtag
Connect to the database from the cluster

In this example, we use DHCP to assign IP addresses to node pools. Therefore, the database must be in the same subnet as the DHCP server.

To enable connectivity, follow these steps:

  1. Connect node pools to the private LAN, which is connected to the database:

circle-info

Note: It may take a while for the node pool to be ready.

  1. Create a pod to test the connectivity. Schedule the pod exclusively for the node pools connected to the additional LAN if you have several node pools.

Alternatively, you can also use the following commands:

  1. Create the pod: kubectl apply -f pod.yaml

  2. Attach the pod and test connectivity:

circle-check

Result: The database starts accepting connections.

via the API. The API does not provide a way to change the credentials yet. However, you can change them later using raw SQL.
  • The data center must be provided as a UUID. The easiest way to retrieve the UUID is through the Cloud APIarrow-up-right.

  • The sample UUID is 498ae72f-411f-11eb-9d07-046c59cc737e.

  • Verify the Status of a MariaDB Cluster
    curl -X 'DELETE' \
      'https://mariadb.de-txl.ionos.com/clusters/498ae72f-411f-11eb-9d07-046c59cc737e' \
      -H 'accept: application/json'
    ionosctlarrow-up-right
    curl -X 'POST' \
      'https://mariadb.de-txl.ionos.com/clusters' \
      -H 'accept: application/json' \
      -H 'Content-Type: application/json' \
      -d '{
      "properties": {
        "mariadbVersion": "10.6",
        "instances": 2,
        "cores": 4,
        "ram": 2,
        "storageSize": 10,
        "connections": [
          {
            "datacenterId": "5a029f4a-72e5-11ec-90d6-0242ac120003",
            "lanId": "2",
            "cidr": "192.168.1.100/24"
          }
        ],
        "displayName": "MariaDB cluster",
        "maintenanceWindow": {
          "time": "16:30:59",
          "dayOfTheWeek": "Monday"
        },
        "credentials": {
          "username": "db-admin",
          "password": "TopSecret!"
        }
      }
    }'
    {
      "type": "cluster",
      "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
      "metadata": {
        "createdDate": "2020-12-10T13:37:50+01:00",
        "createdBy": "[email protected]",
        "createdByUserId": "87f9a82e-b28d-49ed-9d04-fba2c0459cd3",
        "lastModifiedDate": "2020-12-11T13:37:50+01:00",
        "lastModifiedBy": "[email protected]",
        "lastModifiedByUserId": "87f9a82e-b28d-49ed-9d04-fba2c0459cd3",
        "state": "BUSY"
      },
      "properties": {
        "displayName": "MariaDB cluster",
        "mariadbVersion": "10.6",
        "dnsName": "ma-yourcluster.mariadb.region.ionos.com",
        "instances": 2,
        "ram": 2,
        "cores": 4,
        "storageSize": 10,
        "connections": [
          {
            "datacenterId": "5a029f4a-72e5-11ec-90d6-0242ac120003",
            "lanId": "2",
            "cidr": "192.168.1.100/24"
          }
        ],
        "maintenanceWindow": {
          "time": "16:30:59",
          "dayOfTheWeek": "Monday"
        }
      }
    }
      {
      "type": "cluster",
      "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
      "metadata": {
        "createdDate": "2020-12-10T13:37:50+01:00",
        "createdBy": "[email protected]",
        "createdByUserId": "87f9a82e-b28d-49ed-9d04-fba2c0459cd3",
        "lastModifiedDate": "2020-12-11T13:37:50+01:00",
        "lastModifiedBy": "[email protected]",
        "lastModifiedByUserId": "87f9a82e-b28d-49ed-9d04-fba2c0459cd3",
        "state": "DESTROYING"
      },
      "properties": {
        "displayName": "MariaDB cluster",
        "mariadbVersion": "10.6",
        "dnsName": "ma-yourcluster.mariadb.region.ionos.com",
        "instances": 2,
        "ram": 2,
        "cores": 4,
        "storageSize": 10,
        "connections": [
          {
            "datacenterId": "5a029f4a-72e5-11ec-90d6-0242ac120003",
            "lanId": "2",
            "cidr": "192.168.1.100/24"
          }
        ],
        "maintenanceWindow": {
          "time": "16:30:59",
          "dayOfTheWeek": "Monday"
        }
      }
    }
    ionosctl k8s nodepool create --cluster-id xyz-my-cluster --datacenter-id xyz-my-datacenter --lan-ids 3 --dhcp=true --name=my_nodepool
    # pod.yaml
    apiVersion: v1
    kind: Pod
    metadata:
      name: connectivity-test
      labels:
        role: connectivity-test
    spec:
      containers:
      - name: connectivity-test
        image: mysql
        stdin: true
        tty: true
        command:
          - "/bin/bash"
    kubectl attach -it connectivity-test
    mysql -u <USERNAME> -p -h <DNS_NAME> --execute \"SHOW DATABASES;\"

    Create a MariaDB Cluster from a Backup

    The request creates a new MariaDB cluster, which involves restoring a backup of an existing MariaDB cluster and configuring it to function as a new cluster. Ensure you have a backup of your MariaDB cluster containing all the necessary data and configuration files for appropriate functioning.

    hashtag
    Prerequisite

    • Only contract administrators, owners, and users with Access and manage DBaaS privilege can create and manage MariaDB clusters. Ensure that you have the necessary privilege.

    hashtag
    Request

    circle-info

    Note:

    • After creating a database, you can access it via the corresponding LAN using the same username and password specified during creation.

    • This is the only opportunity to set the username and password

    hashtag
    Response

    Your values will differ from those in the sample code. It may contain different IDs, timestamps etc.

    The created cluster is returned with metadata.state set to BUSY, which indicates that the cluster is not yet reachable. This is because the cloud will create a completely new cluster and needs to provision new nodes for all the requested replicas.

    200 Successful operation

    After creation, remember to validate the status of your MariaDB cluster. For more information, see .

    via the API. The API does not provide a way to change the credentials yet. However, you can change them later using raw SQL.
  • The data center must be provided as a UUID. The easiest way to retrieve the UUID is through the Cloud APIarrow-up-right.

  • The sample UUID in the example is 498ae72f-411f-11eb-9d07-046c59cc737e.

  • Verify the Status of a MariaDB Cluster
    curl -X 'POST' \
      'https://mariadb.de-txl.ionos.com/clusters' \
      -H 'accept: application/json' \
      -H 'Content-Type: application/json' \
      -d '{
    {
      "properties": {
        "mariadbVersion": "10.6",
        "instances": 3,
        "cores": 4,
        "ram": 4,
        "storageSize": 10,
        "connections": [
          {
            "datacenterId": "5a029f4a-72e5-11ec-90d6-0242ac120003",
            "lanId": "2",
            "cidr": "192.168.1.100/24"
          }
        ],
        "displayName": "MariaDB cluster",
        "maintenanceWindow": {
          "time": "16:30:59",
          "dayOfTheWeek": "Monday"
        },
        "credentials": {
          "username": "cluster_admin",
          "password": "my-t0p-secret-password"
        },
        "fromBackup": {
          "backupId": "498ae72f-411f-11eb-9d07-046c59cc737e",
          "recoveryTargetTime": "2020-12-10T13:37:50+01:00"
        }
      }
    }'
    {
      "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
      "metadata": {
        "createdDate": "2020-12-10T13:37:50+01:00",
        "createdBy": "[email protected]",
        "createdByUserId": "87f9a82e-b28d-49ed-9d04-fba2c0459cd3",
        "lastModifiedDate": "2020-12-11T13:37:50+01:00",
        "lastModifiedBy": "[email protected]",
        "lastModifiedByUserId": "87f9a82e-b28d-49ed-9d04-fba2c0459cd3",
        "state": "AVAILABLE"
      },
      "properties": {
        "displayName": "MariaDB cluster",
        "mariadbVersion": "10.6",
        "dnsName": "ma-yourcluster.mariadb.region.ionos.com",
        "instances": 3,
        "ram": 4,
        "cores": 4,
        "storageSize": 10,
        "connections": [
          {
            "datacenterId": "5a029f4a-72e5-11ec-90d6-0242ac120003",
            "lanId": "2",
            "cidr": "192.168.1.100/24"
          }
        ],
        "maintenanceWindow": {
          "time": "16:30:59",
          "dayOfTheWeek": "Monday"
        }
      }
    }

    API How-Tos

    This section provides detailed guides and examples on how to interact with the MariaDB REST API. Each guide covers specific tasks such as creating, managing, and deleting MariaDB clusters, as well as handling backups and connecting from Kubernetes.

    hashtag
    Quick Links

    hashtag
    Endpoints

    A regional endpoint is necessary to interact with the MariaDB REST API endpoints. For more information, see the .

    IONOS Cloud supports the following endpoints for various locations:

    • Berlin, Germany: https://mariadb.de-txl.ionos.com/clusters.

    • Frankfurt, Germany: https://mariadb.de-fra.ionos.com/clusters

    • Logroño, Spain: https://mariadb.es-vit.ionos.com/clusters

    hashtag
    Request parameter headers

    To make authenticated requests to the API, the following fields are mandatory in the request headers:

    Header
    Required
    Type
    Description

    hashtag
    Examples

    The documentation contains curl examples, as the tool is available on Windows 10, Linux, and macOS. You can also refer to the following blog posts on the IONOS Cloud website that describe how to execute curl in and systems if you encounter any problems.

    Verify the Status of a MariaDB Cluster

    The database will be deployed in about five minutes after the creation of your first MariaDB cluster. For more information about creating a MariaDB cluster, see .

    You can manually verify whether the create request is successful because the notification mechanism is not yet available. However, you can poll the API to see when the state switches to AVAILABLE. You can use the following command:

    hashtag
    Initialize the database and connect it to the cluster

    London, United Kingdom: https://mariadb.gb-lhr.ionos.com/clusters

  • Worcester, United Kingdom: https://mariadb.gb-bhx.ionos.com/clusters

  • Newark, United States: https://mariadb.us-ewr.ionos.com/clusters

  • Las Vegas, United States: https://mariadb.us-las.ionos.com/clusters

  • Lenexa, United States: https://mariadb.us-mci.ionos.com/clusters

  • Paris, France: https://mariadb.fr-par.ionos.com/clusters

  • Authorization

    yes

    string

    HTTP Basic authorization. A base64 encoded string of a username and password separated by a colon. [email protected]:password

    X-Contract-Number

    no

    integer

    Users with more than one contract may apply this header to indicate the applicable contract.

    Content-Type

    yes

    string

    Prerequisites

    A list of prerequisites to assure success with MariaDB creation.

    Create a MariaDB Cluster

    Learn to create a MariaDB cluster.

    Verify the status of a MariaDB Cluster

    Learn to verify the status of a MariaDB cluster.

    Connect from Kubernetes

    Learn how to connect to MariaDB from your managed Kubernetes cluster.

    List MariaDB Clusters

    Learn how to list the MariaDB clusters.

    Fetch a MariaDB Cluster

    Learn how to fetch a specific MariaDB cluster.

    Delete a MariaDB Cluster

    Learn how to delete a specific MariaDB cluster.

    List MariaDB Cluster Backups

    Learn how to retrieve a list of backups for all MariaDB clusters.

    Fetch a specific Backup of a MariaDB Cluster

    Learn how to retrieve a specific backup of a MariaDB cluster.

    Retrieve all Backups of a MariaDB Cluster

    Learn how to retrieve all backups of a specific MariaDB cluster.

    Create a MariaDB Cluster from a Backup

    Learn how to create a MariaDB cluster from an existing backup.

    Restore a MariaDB Cluster from a Backup

    Learn how to restore a MariaDB cluster from a backup.

    API specification filearrow-up-right
    Linuxarrow-up-right
    Windowsarrow-up-right

    Set this to application/json.

    You can connect to your MariaDB cluster soon after its creation. For example, you can connect using the ssh command as follows and the credentials that you set in the POST request:

    You can use the following command to set the environment:

    Alternatively, you can use the following commands to connect to the database:

    Description
    Command

    via the IP address

    mysql -u username -h "${DATABASE_IP}" --password=password

    via the DNS name

    mysql --ssl -u username --password=password -h "${DNS_NAME}"

    hashtag
    Manage access

    You can create additional users, roles, databases, and other objects via the SQL. These operations are highly dependent on your database architecture.

    The PUBLIC role is a special role in which all database users inherit the permissions. This is also important if you want to have a user without write permissions, since by default PUBLIC is only allowed to write to the public schema.

    For more information about managing databases, refer to the MariaDB Documentationarrow-up-right.

    hashtag
    Create Users

    The CREATE USER statement can be used to create one or more user accounts in the MariaDB database. Only users with the global CREATE USER privilege or the INSERT privilege for the MySQL database can create users. For more information, refer to the MariaDB Documentationarrow-up-right.

    circle-check

    Result: You now have a ready-to-use MariaDB cluster.

    Create a MariaDB Cluster
    while [[ $(curl -sXGET "https://mariadb.de-txl.ionos.com/clusters/${UUID}" -H "Authorization: Bearer ${TOKEN}" | jq -r .metadata.state) != "AVAILABLE" ]]; do
      sleep 5
      clear
      echo -e "Cluster status:\n"
      kg mariadbcluster "${UUID}" -ojsonpath='{.status.conditions}' | yq -P
      echo -e "\ncluster is not available yet, waiting 5 seconds..."
    done
    ssh -i .ignore.id_rsa "root@${CUSTOMER_PUBLIC_IP}"
    DATABASE_IP="CUSTOMER_PUBLIC_IP"
    read -p "DNS Name: " DNS_NAME
    CREATE USER user@abc IDENTIFIED BY 'password';
    GRANT SELECT ON table.t2 to 'user'@'%';

    List MariaDB Clusters

    You can retrieve a list of MariaDB clusters and also specify the maximum number of elements to be returned by specifying an integer for limit and defining the pagination using offset.

    Additionally, you can also use a response filter (filter.name) to list only the MariaDB clusters that contain the specified name.

    hashtag
    Request

    curl -X 'GET' \
      'https://mariadb.de-txl.ionos.com/clusters?limit=100&offset=200' \
      -H 'accept: application/json'

    hashtag
    Response

    202 Successful operation

    {
      "type": "collection",
      "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
      "items": [
        {
          "type": "cluster",
          "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
          "metadata": {
            "createdDate": "2020-12-10T13:37:50+01:00",
            "createdBy": "[email protected]",
            "createdByUserId": "87f9a82e-b28d-49ed-9d04-fba2c0459cd3",
            "lastModifiedDate": "2020-12-11T13:37:50+01:00",
            "lastModifiedBy": "[email protected]",
            "lastModifiedByUserId": "87f9a82e-b28d-49ed-9d04-fba2c0459cd3",
            "state": "AVAILABLE"
          },
          "properties": {
            "displayName": "MariaDB cluster",
            "mariadbVersion": "10.6",
            "dnsName": "ma-yourcluster.mariadb.region.ionos.com",
            "instances": 2,
            "ram": 2,
            "cores": 4,
            "storageSize": 10,
            "connections": [
              {
                "datacenterId": "5a029f4a-72e5-11ec-90d6-0242ac120003",
                "lanId": "2",
                "cidr": "192.168.1.100/24"
              }
            ],
            "maintenanceWindow": {
              "time": "16:30:59",
              "dayOfTheWeek": "Monday"
            }
          }
        }
      ],
      "offset": 200,
      "limit": 100,
      "_links": {
        "prev": "<PREVIOUS-PAGE-URI>",
        "self": "<THIS-PAGE-URI>",
        "next": "<NEXT-PAGE-URI>"
      }
    }