All pages
1 of 9

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Scale a PostgreSQL Cluster Horizontally

DBaaS supports increasing and decreasing the amount of your database replicas. To do so, issue a PATCH request containing the new replica count (between 1 and 5):

Endpoint

Use the following endpoint to scale your PostgreSQL cluster horizontally :https://api.ionos.com/databases/postgresql/clusters/{clusterId}

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

Request

curl --include \
    --request PATCH \
    --user "[email protected]:Mb2.r5oHf-0t" \
    --header "Content-Type: application/json" \
    --data-binary '{
      "metadata": {},
      "properties": {
        "instances": 1
      }
    }' \
    https://api.ionos.com/cloudapi/databases/postgres/clusters/498ae72f-411f-11eb-9d07-046c59cc737e

Response

{
  "type": "cluster",
  "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
  "metadata": {
    "state": "AVAILABLE",
    "createdDate": "2020-12-10T12:37:50.000Z",
    "createdBy": "[email protected]",
    "createdByUserId": "012342f-411f-1eeb-9d07-046c59cc737e",
    "lastModifiedDate": "2020-12-18T21:37:50.000Z",
    "lastModifiedBy": "[email protected]",
    "lastModifiedByUserId": "012342f-411f-1eeb-9d07-046c59cc737e"
  },
    "properties": {
        "displayName": "an even better name",
        "location": "de/txl",
        "dnsName": "pg-pgov71sjg1c875ji.postgresql.de-txl.ionos.com",
        "connections": [
            {
                "datacenterId": "db7e8811-cfae-4b40-82ee-2f4cff81e105",
                "lanId": "2",
                "cidr": "10.7.222.3/23"
            }
        ],
        "cores": 4,
        "postgresVersion": "15",
        "ram": 4096,
        "instances": 1,
        "storageSize": 102400,
        "storageType": "HDD",
        "maintenanceWindow": {
            "dayOfTheWeek": "Wednesday",
            "time": "12:08:00"
        },
        "synchronizationMode": "ASYNCHRONOUS",
        "connectionPooler": {
            "enabled": false,
            "poolMode": "transaction"
        }
    }
  }

Caution: Scaling down can result in failovers and interrupt open connections.

Rename a PostgreSQL Cluster

With the PATCH request, you can change the name of your database cluster.

Endpoint

Use the following endpoint to rename a PostgreSQL cluster:https://api.ionos.com/databases/postgresql/clusters/{clusterId}

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

Request

curl --include \
    --request PATCH \
    --user "[email protected]:Mb2.r5oHf-0t" \
    --header "Content-Type: application/json" \
    --data-binary '{
      "metadata": {},
      "properties": {
        "displayName": "an even better name"
      }
    }' \
    https://api.ionos.com/databases/postgresql/clusters/498ae72f-411f-11eb-9d07-046c59cc737e

Response

{
  "type": "cluster",
  "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
  "metadata": {
    "state": "AVAILABLE",
    "createdDate": "2020-12-10T12:37:50.000Z",
    "createdBy": "[email protected]",
    "createdByUserId": "012342f-411f-1eeb-9d07-046c59cc737e",
    "lastModifiedDate": "2020-12-18T21:37:50.000Z",
    "lastModifiedBy": "[email protected]",
    "lastModifiedByUserId": "012342f-411f-1eeb-9d07-046c59cc737e"
  },
  "properties": {
  "displayName": "an even better name",
  "location": "DE/FRA",
  ...
  }
}

Upgrade a PostgreSQL Cluster

DBaaS supports upgrading a PostgreSQL cluster to a higher major version in-place. To do so, issue a PATCH request containing the target postgresVersion:

Endpoint

Use the following endpoint to upgrade your PostgreSQL cluster:https://api.ionos.com/databases/postgresql/clusters/{clusterId}

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

Request

curl --include \
    --request PATCH \
    --user "[email protected]:Mb2.r5oHf-0t" \
    --header "Content-Type: application/json" \
    --data-binary '{
      "metadata": {},
      "properties": {
        "postgresVersion": "15"
      }
    }' \
    https://api.ionos.com/databases/postgresql/clusters/498ae72f-411f-11eb-9d07-046c59cc737e

Response

{
  "type": "cluster",
  "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
  "metadata": {
    "state": "AVAILABLE",
    "createdDate": "2020-12-10T12:37:50.000Z",
    "createdBy": "[email protected]",
    "createdByUserId": "012342f-411f-1eeb-9d07-046c59cc737e",
    "lastModifiedDate": "2020-12-18T21:37:50.000Z",
    "lastModifiedBy": "[email protected]",
    "lastModifiedByUserId": "012342f-411f-1eeb-9d07-046c59cc737e"
  },
    "properties": {
        "displayName": "an even better name",
        "location": "de/txl",
        "dnsName": "pg-pgov71sjg1c875ji.postgresql.de-txl.ionos.com",
        "connections": [
            {
                "datacenterId": "db7e8811-cfae-4b40-82ee-2f4cff81e105",
                "lanId": "2",
                "cidr": "10.7.222.3/23"
            }
        ],
        "cores": 1,
        "postgresVersion": "15",
        "ram": 4096,
        "instances": 1,
        "storageSize": 102400,
        "storageType": "HDD",
        "maintenanceWindow": {
            "dayOfTheWeek": "Wednesday",
            "time": "12:08:00"
        },
        "synchronizationMode": "ASYNCHRONOUS",
        "connectionPooler": {
            "enabled": false,
            "poolMode": "transaction"
        }
    }
}

The upgrade procedure is efficient and should only take a few minutes, even for large databases. The database will be unavailable, potentially multiple times, until the upgrade is complete. Once the upgrade is complete, a new backup is automatically created.

Once the upgrade is triggered, it cannot be undone. If the upgrade fails or causes unexpected behavior in the application, you can restore the old state by creating a new database from the previous backup. An in-place restore will only apply the old data and not roll back to the older PostgreSQL version.

Caution: Executing in-place upgrades cause the removal of database objects and extensions that are deemed incompatible with the target version. To mitigate potential application failure, always test the upgrade against a database clone to confirm stability before proceeding.

.

Scale a PostgreSQL Cluster Vertically

DBaaS supports increasing or decreasing the size of your database instances, such as cores or ram. You can modify either one or both simultaneously by sending a PATCH request with the new size specifications.

Endpoint

Use the following endpoint to scale your PostgreSQL cluster vertically :https://api.ionos.com/databases/postgresql/clusters/{clusterId}

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

Request

curl --include \
    --request PATCH \
    --user "[email protected]:Mb2.r5oHf-0t" \
    --header "Content-Type: application/json" \
    --data-binary '{
      "metadata": {},
      "properties": {
        "cores": 4,
        "ram": 4096
      }
    }' \
    https://api.ionos.com/databases/postgresql/clusters/498ae72f-411f-11eb-9d07-046c59cc737e

Response

{
  "type": "cluster",
  "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
  "metadata": {
    "state": "AVAILABLE",
    "createdDate": "2020-12-10T12:37:50.000Z",
    "createdBy": "[email protected]",
    "createdByUserId": "012342f-411f-1eeb-9d07-046c59cc737e",
    "lastModifiedDate": "2020-12-18T21:37:50.000Z",
    "lastModifiedBy": "[email protected]",
    "lastModifiedByUserId": "012342f-411f-1eeb-9d07-046c59cc737e"
  },
    "properties": {
        "displayName": "an even better name",
        "location": "de/txl",
        "dnsName": "pg-pgov71sjg1c875ji.postgresql.de-txl.ionos.com",
        "connections": [
            {
                "datacenterId": "db7e8811-cfae-4b40-82ee-2f4cff81e105",
                "lanId": "2",
                "cidr": "10.7.222.3/23"
            }
        ],
        "cores": 4,
        "postgresVersion": "15",
        "ram": 4096,
        "instances": 1,
        "storageSize": 102400,
        "storageType": "HDD",
        "maintenanceWindow": {
            "dayOfTheWeek": "Wednesday",
            "time": "12:08:00"
        },
        "synchronizationMode": "ASYNCHRONOUS",
        "connectionPooler": {
            "enabled": false,
            "poolMode": "transaction"
        }
    }
  }

Caution: This change replaces the underlying nodes and triggers one failover. Schedule this change during a maintenance window and ensure applications can handle a brief connectivity interruption.

Increase a PostgreSQL Cluster Storage Size

DBaaS supports increasing the storage size of your cluster in-place, performing the resize operation online without any downtime. To do so, simply issue a PATCH request containing the new storageSize:

Endpoint

Use the following endpoint to increase the storage size of your PostgreSQL cluster:https://api.ionos.com/databases/postgresql/clusters/{clusterId}

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

Request

Response

Caution: Decreasing the storage size is not supported.

curl --include \
    --request PATCH \
    --user "[email protected]:Mb2.r5oHf-0t" \
    --header "Content-Type: application/json" \
    --data-binary '{
      "metadata": {},
      "properties": {
        "storageSize": 50000
      }
    }' \
    https://api.ionos.com/databases/postgresql/clusters/498ae72f-411f-11eb-9d07-046c59cc737e
{
  "type": "cluster",
  "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
  "metadata": {
    "state": "AVAILABLE",
    "createdDate": "2020-12-10T12:37:50.000Z",
    "createdBy": "[email protected]",
    "createdByUserId": "012342f-411f-1eeb-9d07-046c59cc737e",
    "lastModifiedDate": "2020-12-18T21:37:50.000Z",
    "lastModifiedBy": "[email protected]",
    "lastModifiedByUserId": "012342f-411f-1eeb-9d07-046c59cc737e"
  },
   "properties": {
        "displayName": "an even better name",
        "location": "de/txl",
        "dnsName": "pg-pgov71sjg1c875ji.postgresql.de-txl.ionos.com",
        "connections": [
            {
                "datacenterId": "db7e8811-cfae-4b40-82ee-2f4cff81e105",
                "lanId": "2",
                "cidr": "10.7.222.3/23"
            }
        ],
        "cores": 1,
        "postgresVersion": "15",
        "ram": 4096,
        "instances": 1,
        "storageSize": 102400,
        "storageType": "HDD",
        "maintenanceWindow": {
            "dayOfTheWeek": "Wednesday",
            "time": "12:08:00"
        },
        "synchronizationMode": "ASYNCHRONOUS",
        "connectionPooler": {
            "enabled": false,
            "poolMode": "transaction"
        }
    }
}

Active a PostgreSQL Connection Pooler

You can activate a managed connection pooler (pgbouncer). Besides enabling it, you can only configure the poolMode. Currently, we support two modes:

  • transaction: The connection is released back to the pool after the transaction is completed. It is the default mode.

  • session: The connection is released back to the pool after the client disconnects.

Note: To use pgbouncer, change the port to connect to the database from 5432 (the default) to 6432. For example: For psql use psql -h pg-3euh45am6idkppu3.postgresql.de-fra.ionos.com -U myuser -d mydb --port=6432.

Endpoint

To activate the connection pooler, send PATCH request to the following endpoint:https://api.ionos.com/databases/postgresql/clusters/{clusterId}

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

Request

curl --include \
    --request PATCH \
    --user "[email protected]:Mb2.r5oHf-0t" \
    --header "Content-Type: application/json" \
    --data-binary '{
      "metadata": {},
      "properties": {
        "connectionPooler": {
          "enabled": true,
          "poolMode": "session"
        }
      }
    }' \
    https://api.ionos.com/databases/postgresql/clusters/498ae72f-411f-11eb-9d07-046c59cc737e

Response

{
  "type": "cluster",
  "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
  "metadata": {
    "state": "AVAILABLE",
    "createdDate": "2020-12-10T12:37:50.000Z",
    "createdBy": "[email protected]",
    "createdByUserId": "012342f-411f-1eeb-9d07-046c59cc737e",
    "lastModifiedDate": "2020-12-18T21:37:50.000Z",
    "lastModifiedBy": "[email protected]",
    "lastModifiedByUserId": "012342f-411f-1eeb-9d07-046c59cc737e"
  },
  "properties": {
        "displayName": "an even better name",
        "location": "de/txl",
        "dnsName": "pg-pgov71sjg1c875ji.postgresql.de-txl.ionos.com",
        "connections": [
            {
                "datacenterId": "db7e8811-cfae-4b40-82ee-2f4cff81e105",
                "lanId": "2",
                "cidr": "10.7.222.3/23"
            }
        ],
        "cores": 4,
        "postgresVersion": "15",
        "ram": 4096,
        "instances": 1,
        "storageSize": 102400,
        "storageType": "HDD",
        "maintenanceWindow": {
            "dayOfTheWeek": "Sunday",
            "time": "03:30:00"
        },
        "synchronizationMode": "ASYNCHRONOUS",
        "connectionPooler": {
            "enabled": true,
            "poolMode": "session"
        }
    }
}

Modify Cluster Attributes

Once the PostgreSQL cluster is up and running, you can customize several attributes.

Quick Links

Set a PostgreSQL Maintenance Window

If you do not choose a maintenance window during the creation of your database, a system-defined maintenance window will be assigned to your database. You can update the window at any time, as shown in the example below.

Endpoint

Use the following endpoint to set a PostgreSQL maintenance window:https://api.ionos.com/databases/postgresql/clusters/{clusterId}

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

Request

Response

Response

Caution: When your cluster contains only one replica, you may experience a short downtime during this maintenance window while your database instance is being updated. In a replicated cluster, we only update standbys; however, we may perform a switchover to change the leader node.

Rename a PostgreSQL Cluster

Learn how to rename your PostgreSQL cluster.

Upgrade a PostgreSQL Version

Learn how to upgrade your PostgreSQL version.

Increase a PostgreSQL Cluster Storage Size

Learn how to increase the your PostgreSQL cluster storage size.

Scale a PostgreSQL Cluster Vertically

Learn how to scale your PostgreSQL cluster vertically by adjusting RAM and CPU.

Scale a PostgreSQL Cluster Horizontally

Learn how to scale your PostgreSQL cluster horizontally by adding replicas.

Set a PostgreSQL Maintenance Windows

Learn how to set maintenance windows for your PostgreSQL cluster.

Change a PostgreSQL Connection

Learn how to change the connection of your PostgreSQL cluster.

Activate a PostgreSQL Connection Pooler

Learn how to activate the connection pooler for your PostgreSQL cluster.

curl --include \
    --request PATCH \
    --user "[email protected]:Mb2.r5oHf-0t" \
    --header "Content-Type: application/json" \
    --data-binary '{
      "metadata": {},
      "properties": {
        "maintenanceWindow": {
          "dayOfTheWeek": "Sunday",
          "time": "03:30:00"
        }
      }
    }' \
    https://api.ionos.com/databases/postgresql/clusters/498ae72f-411f-11eb-9d07-046c59cc737e
{
  "type": "cluster",
  "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
  "metadata": {
    "state": "AVAILABLE",
    "createdDate": "2020-12-10T12:37:50.000Z",
    "createdBy": "[email protected]",
    "createdByUserId": "012342f-411f-1eeb-9d07-046c59cc737e",
    "lastModifiedDate": "2020-12-18T21:37:50.000Z",
    "lastModifiedBy": "[email protected]",
    "lastModifiedByUserId": "012342f-411f-1eeb-9d07-046c59cc737e"
  },
"properties": {
        "displayName": "an even better name",
        "location": "de/txl",
        "dnsName": "pg-pgov71sjg1c875ji.postgresql.de-txl.ionos.com",
        "connections": [
            {
                "datacenterId": "db7e8811-cfae-4b40-82ee-2f4cff81e105",
                "lanId": "2",
                "cidr": "10.7.222.3/23"
            }
        ],
        "cores": 4,
        "postgresVersion": "15",
        "ram": 4096,
        "instances": 1,
        "storageSize": 102400,
        "storageType": "HDD",
        "maintenanceWindow": {
            "dayOfTheWeek": "Sunday",
            "time": "03:30:00"
        },
        "synchronizationMode": "ASYNCHRONOUS",
        "connectionPooler": {
            "enabled": false,
            "poolMode": "transaction"
        }
    }
}
{
  "type": "cluster",
  "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
  "metadata": {
    "state": "AVAILABLE",
    "createdDate": "2020-12-10T12:37:50.000Z",
    "createdBy": "[email protected]",
    "createdByUserId": "012342f-411f-1eeb-9d07-046c59cc737e",
    "lastModifiedDate": "2020-12-18T21:37:50.000Z",
    "lastModifiedBy": "[email protected]",
    "lastModifiedByUserId": "012342f-411f-1eeb-9d07-046c59cc737e"
  },
    "properties": {
        "displayName": "an even better name",
        "location": "de/txl",
        "dnsName": "pg-pgov71sjg1c875ji.postgresql.de-txl.ionos.com",
        "connections": [
            {
                "datacenterId": "db7e8811-cfae-4b40-82ee-2f4cff81e105",
                "lanId": "2",
                "cidr": "10.7.222.3/23"
            }
        ],
        "cores": 4,
        "postgresVersion": "15",
        "ram": 4096,
        "instances": 1,
        "storageSize": 102400,
        "storageType": "HDD",
        "maintenanceWindow": {
            "dayOfTheWeek": "Wednesday",
            "time": "12:08:00"
        },
        "synchronizationMode": "ASYNCHRONOUS",
        "connectionPooler": {
            "enabled": false,
            "poolMode": "transaction"
        }
    }
  }

Change a PostgreSQL Connection

After creating your database, you can change the connection to your private LAN or remove it completely. You can change it to be connected to a different LAN or update the IP address. However, you must always include all properties of the connections list for the request, even if you only want to update the database IP address. The newly provided LAN must be located in the same place as the database cluster. Updating the IP address also updates the DNS record of the database's name.

Note: When you change the connection to a new LAN, the database will no longer be reachable in the old network almost immediately. However, the new connection will only be established after your dedicated VMs are updated, which can take a couple of minutes, depending on the number of instances you specified.

Endpoint

To modify the connection settings for your PostgreSQL cluster, send a PATCH request to the following endpoint:https://api.ionos.com/databases/postgresql/clusters/{clusterId}

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

Request

curl --include \
    --request PATCH \
    --user "[email protected]:Mb2.r5oHf-0t" \
    --header "Content-Type: application/json" \
    --data-binary '{
      "properties": {
        "connections": [
          {
            "datacenterId": "b4f86015-9918-443d-be14-aa2eb7529f40",
            "lanId": "2",
            "cidr": "192.168.1.100/24"
          }
        ]
      }
    }' \
    https://api.ionos.com/databases/postgresql/clusters/498ae72f-411f-11eb-9d07-046c59cc737e

In order to remove the connection, you have to specify an empty list in the request body:

{
  "properties": {
    "connections": []
  }
}

Response

{
  "type": "cluster",
  "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
  "metadata": {
    "state": "AVAILABLE",
    "createdDate": "2020-12-10T12:37:50.000Z",
    "createdBy": "[email protected]",
    "createdByUserId": "012342f-411f-1eeb-9d07-046c59cc737e",
    "lastModifiedDate": "2020-12-18T21:37:50.000Z",
    "lastModifiedBy": "[email protected]",
    "lastModifiedByUserId": "012342f-411f-1eeb-9d07-046c59cc737e"
  },
    "properties": {
        "displayName": "an even better name",
        "location": "de/txl",
        "dnsName": "pg-pgov71sjg1c875ji.postgresql.de-txl.ionos.com",
        "connections": [
            {
                "datacenterId": "db7e8811-cfae-4b40-82ee-2f4cff81e105",
                "lanId": "2",
                "cidr": "10.7.222.3/23"
            }
        ],
        "cores": 4,
        "postgresVersion": "15",
        "ram": 4096,
        "instances": 1,
        "storageSize": 102400,
        "storageType": "HDD",
        "maintenanceWindow": {
            "dayOfTheWeek": "Sunday",
            "time": "03:30:00"
        },
        "synchronizationMode": "ASYNCHRONOUS",
        "connectionPooler": {
            "enabled": true,
            "poolMode": "session"
        }
    }
}