PostgreSQL
-
Go to the VK Cloud management console.
-
Select the project where the desired DB instance is located.
-
Go to Databases → Database instances.
-
Perform the desired operation:
Start an instanceRestart an instanceStop an instance-
To start a DB instance as a whole with all of its hosts, perform one of the following actions:
- Select one or more DB instances using the checkboxes, then click Start.
- Click
for the DB instance host with the
Masterrole and select Start.
-
To start a separate replica of a DB instance, click
for the desired host with the
Replicarole and select Start.
-
Different information is available for active and stopped DB instances.
-
Go to the VK Cloud management console.
-
Select the project where the desired DB instance is located.
-
Go to Databases → Database instances.
-
Perform the desired operation:
-
To view information about a DB instance, click its name.
-
To view information about a separate host of a DB instance, click the host name.
A page with the information will open.
-
You can assign an external IP address or unbind it at the level of an individual host that is part of a DB instance:
-
Go to the VK Cloud management console.
-
Select the project where the desired DB instance is located.
-
Go to Databases → Database instances.
-
Perform the desired operation:
Assign an external IP address to a hostUnbind an external IP address from a host- Click
for the desired host and select Assign external IP.
- Select an existing IP address or the Add a new IP option from the drop-down list.
- Click Confirm.
- Click
The operation is described in detail in the section Creating a backup manually.
To expand an instance, add a replica to it. The operation is described in detail in the section Replication.
You can change the virtual machine type used by the hosts of a DB instance:
-
Go to the VK Cloud management console.
-
Select the project where the desired DB instance is located.
-
Go to Databases → Database instances.
-
To perform vertical scaling:
Single configurationMaster-Replica configurationCluster configuration- Click
for the DB instance host with the
Masterrole and select Vertical scaling. - Select the desired virtual machine category and type.
- Click Save size.
- Click
To update a DB instance, create its backup in the Cloud Backup service and restore it to an instance with a newer PostgreSQL version.
-
Create a backup.
-
Prepare a new DB instance with the version you need to upgrade to using restoration from the previously created Cloud Backup backup.
-
Install the same extensions as on the original DB instance.
-
If the DB instance is used in real time by applications or services, configure logical replication and wait for the source and subscriber to synchronize.
-
Make sure that all tables in the subscription have the
replicatingstate. To check this on the subscriber, run the query:SELECT * FROM pg_subscription_rel; -
Make sure that the time of the last received and applied change differs by no more than fractions of a second. To check this on the subscriber, run the query:
SELECT * FROM pg_stat_subscription; -
If possible, pause writing to the DB instance used by your application or service.
-
Determine the current lag by LSN. To do this, run the query on the source:
SELECTslot_name,pg_wal_lsn_diff(pg_current_wal_lsn(), confirmed_flush_lsn) AS bytes_lagFROM pg_replication_slots;Repeat the operation several times with a short time interval. Evaluate the obtained values.
- If writing was paused in the previous step: make sure that the LSN difference has stopped decreasing or has become equal to
0. - If writing was not paused in the previous step and new writes continue to arrive: make sure that the LSN difference is not growing and does not exceed the acceptable threshold (usually no more than 10–50 MB, depending on the load and requirements).
- If writing was paused in the previous step: make sure that the LSN difference has stopped decreasing or has become equal to
-
-
Switch services and applications to the new DB instance. Make sure that the former DB instance is no longer used.
-
Perform a test shutdown of the former instance. To do this, unbind the external Floating IP address from the former DB instance.
If the test shutdown fails, assign the same Floating IP address again and re-check that all necessary services and applications work with the new DB instance.
-
Delete the former DB instance.
For DB instances in the Master-Replica configuration, you can promote a replica to a separate DB instance.
- Go to the VK Cloud management console.
- Select the project where the desired DB instance is located.
- Go to Databases → Database instances.
- Click
for the desired DB instance host with the
Replicarole and select Promote to master. - Read the warning and click Confirm.
For DB instances in the Cluster configuration, you can switch the Master role from the current host to a host with the Sync replica role:
- Go to the VK Cloud management console.
- Select the project where the desired DB instance is located.
- Go to Databases → Database instances.
- Click
for the DB instance host with the
Sync replicarole and select Assign as master. - Read the warning and click Assign.
A WAL disk is a disk where the write-ahead log (WAL) is stored. To increase its size:
-
Go to the VK Cloud management console.
-
Select the project where the desired DB instance is located.
-
Go to Databases → Database instances.
-
Increase the WAL disk size:
Single configurationMaster-Replica configurationCluster configuration-
Perform one of the following actions:
- Click
for the desired DB instance and select Change WAL disk size.
- Click
for the DB instance host with the
Masterrole and select Change WAL disk size.
- Click
-
Specify the new disk size.
-
Click Save.
-
-
Go to the VK Cloud management console.
-
Select the project where the desired DB instance is located.
-
Go to Databases → Database instances.
-
Increase the size of the disk where the data is stored:
Single configurationMaster-Replica configurationCluster configuration-
Perform one of the following actions:
- Click
for the desired DB instance and select Change disk size.
- Click
for the DB instance host with the
Masterrole and select Change disk size.
- Click
-
Specify the new disk size.
-
Click Save.
-
-
Go to the VK Cloud management console.
-
Select the project where the desired DB instance is located.
-
Go to Databases → Database instances.
-
Configure autoscaling for the disk where the data is stored:
Single configurationMaster-Replica configurationCluster configuration-
Perform one of the following actions:
- Click
for the desired DB instance and select Change disk autoscaling.
- Click
for the DB instance host with the
Masterrole and select Change disk autoscaling.
- Click
-
Enable or disable the disk autoscaling option.
-
If the autoscaling option is enabled, set the maximum disk size.
-
Click Confirm.
-
-
Go to the VK Cloud management console.
-
Select the project where the desired DB instance is located.
-
Go to Databases → Database instances.
-
Depending on the configuration, you can delete either the entire instance or its individual replicas:
Single configurationMaster-Replica configurationCluster configuration- Click
for the desired DB instance and select Delete.
- Click Confirm.
- Click