FAQ about Managed Service for PostgreSQL
General questions
-
What parts of database management and maintenance does Managed Service for PostgreSQL handle?
-
When should I use Managed Service for PostgreSQL, and when should I use VMs running databases?
-
Which PostgreSQL version does Managed Service for PostgreSQL use?
-
How can I change the compute and storage capacity for a database cluster?
-
When does the backup run? Does a database cluster remain online during backups?
-
Is encryption enabled for PostgreSQL database cluster connections?
-
What restrictions are placed on PostgreSQL database clusters?
-
What PostgreSQL extensions are supported in Managed Service for PostgreSQL?
-
Does the service comply with the Russian Federal Law 152-FZ on personal data?
-
Why is my cluster slow even though the computational resources are not being fully utilized?
Connection
-
How do I obtain an SSL certificate for connecting to Managed Service for PostgreSQL on Windows?
-
How do I install an SSL certificate to connect Power BI to Managed Service for PostgreSQL via psql?
-
Why am I getting an error when trying to connect to a database from Looker Studio?
-
How to ensure I am always connecting to the most up-to-date replica?
Updating a cluster
-
Why did my cluster switch to the Updating status during an unscheduled backup?
-
How can I change the number of connections available for a user?
-
Can I change the host class (standard, memory-optimized, burstable) for an existing host?
Cluster parameter settings
Moving and restoring a cluster
-
Do I need the wal2json plugin if I am only doing replication and not copying?
-
How do I move a local PostgreSQL database dump to Yandex Cloud?
-
How do I migrate a database or a table from one cluster to another?
-
How do I transfer data between clusters in different folders or clouds?
-
How do I restore a cluster to the state of the selected backup?
Users and roles
High availability and load balancing
-
Why do I get an error when setting up cascading replication?
-
How to ensure I am always connecting to the most up-to-date replica?
-
Can I configure multi-master within a single cluster or between two clusters?
-
How to configure load balancing so that all read requests are redirected to replicas?
Monitoring and logs
-
Are logs stored on the same disk as PostgreSQL data? How are they billed?
-
What does the
Cachedmetric indicate in the RAM monitoring of a PostgreSQL cluster host? -
How do I set up an alert that triggers when a certain percentage of disk space is used?
Error messages
-
What should I do if I get an
SSL is requirederror when connecting? -
What should I do if I get a
too many active clients for usererror when connecting? -
Why do I get an error when connecting to a postgres database?
-
Why does my connection terminate with
terminating connection due to administrator command? -
Why do I get an error when transferring data by creating and restoring a logical dump
-
Why do I get a
must be owner of extensionerror when restoring a logical dump? -
Why do I get an error when setting up cascading replication?
-
Why do I get a
cannot execute <SQL_command> in a read-only transactionerror? -
What should I do if I see a
too many connections for role "monitor"error in the logs? -
Why do I get an error when trying to install multiple extensions in the CLI?
General questions
What is Managed Service for PostgreSQL?
Managed Service for PostgreSQL is a service that helps you create, operate, and scale PostgreSQL databases in the cloud.
With Managed Service for PostgreSQL, you can:
- Create databases with performance settings tailored to your needs.
- Scale your database compute and dedicated storage capacity as needed.
- Access database performance and activity logs.
Managed Service for PostgreSQL handles the heavy lifting of PostgreSQL infrastructure administration for you:
- Provides monitoring of your resource consumption.
- Automatically backs up your databases.
- Ensures fault tolerance through automatic failover to backup replicas.
- Keeps your DBMS software up to date.
You work with a Managed Service for PostgreSQL database cluster just like with your local database. This allows you to fine-tune your database’s internal settings to meet your application’s specific requirements.
What parts of database management and maintenance does Managed Service for PostgreSQL handle?
During cluster creation, Managed Service for PostgreSQL allocates resources, installs the DBMS, and creates the databases.
Managed Service for PostgreSQL automatically manages backups and applies DBMS patches and updates for your deployed databases.
Furthermore, Managed Service for PostgreSQL ensures data replication, both within and across availability zones, with automatic failover to a standby replica during a failure.
Be mindful of what is what is controlled by the service, and what by the Yandex Cloud customer. Understanding these control zones will help you use your cloud resources effectively and avoid potential database-related problems. For more information, see Zones of control between managed database (MDB) service users and Yandex Cloud.
When should I use Managed Service for PostgreSQL, and when should I use VMs running databases?
Yandex Cloud offers you two ways to work with databases:
- With Managed Service for PostgreSQL, you can use template databases, with no administrative effort required.
- Alternatively, with Yandex Compute Cloud virtual machines, you can create and customize your own databases. This approach enables you to use any database management system, access databases via SSH, and more.
What is a database host and what is a database cluster?
A database host is a cloud-based isolated database environment with dedicated computing resources and reserved storage capacity.
A database cluster consists of one or more database hosts with configurable replication between them.
How do I get started with Managed Service for PostgreSQL?
Managed Service for PostgreSQL is available to all registered Yandex Cloud users.
Before you create a database cluster in Managed Service for PostgreSQL, first, decide on its key specifications:
- Host class will determine your computing power: vCPUs, RAM, and more.
- Storage size (fully provisioned once you create the cluster).
- Network for your cluster.
- Number of hosts in your cluster and their availability zones.
Learn more in Getting started with Managed Service for PostgreSQL.
How many database hosts can be in a cluster?
The minimum number of hosts depends on the selected storage type:
-
A minimum of three hosts is required for the following disk types:
- Local SSDs (
local-ssd) - Non-replicated SSDs (
network-ssd-nonreplicated)
- Local SSDs (
-
A single host is sufficient for the following disk types:
- Network HDDs (
network-hdd) - Network SSDs (
network-ssd) - Ultra-fast network SSDs with triple replication (
network-ssd-io-m3)
- Network HDDs (
The maximum number of hosts in a cluster is subject to your quota limits.
For more information, see Quotas and limits in Managed Service for PostgreSQL.
How to get access to a running host?
You can connect to Managed Service for PostgreSQL databases using standard DBMS connection methods.
For details on connecting to clusters, see this article.
How many clusters can I create within a single cloud?
To learn about MDB quotas and limits, see Quotas and limits in Managed Service for PostgreSQL.
How are database clusters maintained?
Maintenance in Managed Service for PostgreSQL includes:
- Automatic DBMS updates and patches for all hosts, even in stopped clusters.
- Scaling computing resources and storage capacity of cluster hosts.
- Other Managed Service for PostgreSQL maintenance tasks.
Learn more in Maintenance in Managed Service for PostgreSQL.
Which PostgreSQL version does Managed Service for PostgreSQL use?
Managed Service for PostgreSQL supports PostgreSQL versions 13-17, and PostgreSQL versions 13-16 for use with 1C.
What happens when a new DBMS version is released?
We update the database software with each new minor release. In advance of the planned updates, we notify the owners of the affected database clusters about the maintenance schedule and any expected downtimes.
What happens when a DBMS version becomes deprecated?
Managed Service for PostgreSQL will automatically email you one month after your cluster’s DBMS version becomes deprecated.
Starting from that moment, you can no longer create new database hosts using this DBMS version. Database clusters are automatically updated to the next supported version 7 days after notification for minor releases and 1 month after notification for major releases. Deprecated major versions will be updated even with automatic updates turned off.
How do you calculate usage cost for a database host?
In Managed Service for PostgreSQL, the usage cost is calculated based on the following parameters:
- Selected host class.
- Reserved storage capacity for the database host.
- Size of the database cluster backups. You get free backup storage equal to your total database storage. Additional backup storage is charged based on our pricing policy.
- Database host uptime in hours. Partial hours are rounded up to the next hour. The hourly rates for each host class are listed in Managed Service for PostgreSQL pricing policy.
How can I change the compute and storage capacity for a database cluster?
You can scale your computing resources and storage size directly in the management console by selecting a different host class for your cluster.
The cluster settings will update within 30 minutes. This window may also be used for other maintenance tasks, such as installing updates.
Can I configure automatic storage expansion for a cluster?
Yes, you can enable automatic storage scaling when creating or updating your cluster.
Are database host backups enabled by default?
Yes, backups are enabled by default. The PostgreSQL backup policies include full daily backups and continuous transaction log archiving. This enables point-in-time recovery, allowing you to restore your cluster to any moment within the backup retention period, with the exception of the last 30 seconds.
By default, backups are retained for 7 days.
When does the backup run? Does a database cluster remain online during backups?
The backup window, the scheduled time for the database cluster’s full daily backup, is from 01:00 to 05:00 (UTC+3).
Clusters remain fully accessible during the backup window.
Is encryption enabled for PostgreSQL database cluster connections?
Connections between your database cluster and application are always encrypted with SSL. You cannot disable encryption for cluster connections.
What is a read-only replica in PostgreSQL?
A read-only replica is a PostgreSQL database cluster host available only for reads that synchronizes its data with the master host. This applies only to clusters with more than one host. You can use a read-only replica to reduce the load on the master host experiencing high read traffic to its database.
What metrics and processes can be monitored?
For all DBMS types, you can monitor the following metrics:
- Absolute CPU, memory, network, and disk utilization.
- Total database cluster size and remaining free storage space.
For database hosts, you can track metrics specific to their DBMS type. For example, for PostgreSQL, you can monitor the following metrics:
- Average query execution time.
- Queries per second.
- Error count in logs, etc.
Monitoring is available with a minimum granularity of 5 seconds.
Can I get logs of my operations in Yandex Cloud?
Yes, you can request information about operations with your resources from Yandex Cloud logs. Do it by contacting support
What restrictions are placed on PostgreSQL database clusters?
To learn about Managed Service for PostgreSQL quotas and limits, see Quotas and limits in Managed Service for PostgreSQL. Also refer to PostgreSQL host classes for the specifications of clusters you can create with Managed Service for PostgreSQL.
What PostgreSQL extensions are supported in Managed Service for PostgreSQL?
See the list of supported PostgreSQL extensions in Managing extensions.
Can I get superuser privileges in PostgreSQL?
No, superuser privileges are not available to Managed Service for PostgreSQL users. Cluster actions of all types are available to users with the mdb_admin role.
Can I copy data from a Managed Service for PostgreSQL table to a local file? Can I populate a table with data from a local file?
Yes, you can both copy data from a table to a local file and import data from a file into a table. For more information, see Copying and populating a table from a local machine.
Are there any specific features or restrictions for the garbage collector in a Managed Service for PostgreSQL cluster?
Managed Service for PostgreSQL clusters support all VACUUM command
- To run
VACUUM FULL, the user must have themdb_adminrole. The VACUUM FULL operation does not affect system tables. - In PostgreSQL version 14, the
INDEX_CLEANUPparameter has been enhanced and now defaults toAUTO. This means theVACUUMcommand will skip index cleanup if it deems it unnecessary. For backward compatibility with older PostgreSQL versions, setINDEX_CLEANUPtoON.
Why is my cluster slow even though the computational resources are not being fully utilized?
Your storage may have insufficient maximum IOPS and bandwidth to process the current number of requests. In this case, throttling occurs, which degrades the entire cluster performance.
The maximum IOPS and bandwidth values increase by a fixed value when the storage size increases by a certain step. The step and increment values depend on the disk type:
| Disk type | Step, GB | Max IOPS increase (read/write) | Max bandwidth increase (read/write), MB/s |
|---|---|---|---|
network-hdd |
256 | 300/300 | 30/30 |
network-ssd |
32 | 1,000/1,000 | 15/15 |
network-ssd-nonreplicated, network-ssd-io-m3 |
93 | 28,000/5,600 | 110/82 |
To increase the maximum IOPS and bandwidth and reduce the risk of throttling, increase the storage size when updating your cluster.
If you are using the network-hdd storage, consider switching to network-ssd or network-ssd-nonreplicated by restoring the cluster from a backup.
Connection
Can I access a cluster from within Yandex Cloud?
You can connect to Managed Service for PostgreSQL cluster hosts:
- Via the internet, if you configured public access for these hosts. These hosts can only be accessed over SSL.
- From Yandex Cloud virtual machines located in the same cloud network. For hosts without public access, SSL is not required to connect to them from these virtual machines.
- From a Yandex Serverless Containers container. For hosts without public access, this container must be located in the same cloud network.
For more information, see the service documentation.
Can I connect to a cluster from a Docker container?
Yes, you can. To do this, configure the Dockerfile.
See a Yandex Serverless Containers container connection example in this tutorial.
How do I obtain an SSL certificate for connecting to Managed Service for PostgreSQL on Windows?
You can obtain an SSL certificate using PowerShell:
mkdir $HOME\.postgresql; curl.exe --output $HOME\.postgresql\root.crt https://storage.yandexcloud.net/cloud-certs/CA.pem
The certificate will be saved to the $HOME\.postgresql\root.crt file.
For details on obtaining a certificate and connecting to a database, see the service documentation.
How do I install an SSL certificate to connect Power BI to Managed Service for PostgreSQL via psql?
-
Install Windows Subsystem for Linux
(WSL) and run the following command in the terminal:mkdir /mnt/c/temp && \ curl "https://storage.yandexcloud.net/cloud-certs/CA.pem" --output /mnt/c/temp/CA.pem && \ openssl pkcs12 -export -out /mnt/c/temp/CA.pfx -nokeys -in /mnt/c/temp/CA.pemThe certificate will be located at
C:\temp\CA.pfx. -
Install the obtained certificate in the Windows Certificate Store
.
Can I connect to cluster hosts over SSH?
You cannot connect to hosts via SSH. This is done for the sake of security and user cluster fault tolerance because direct changes inside a host can render it completely inoperable.
What is the maximum allowed number of concurrent connections per host in Managed Service for PostgreSQL?
The number of concurrent connections is configured at the cluster level using the Max connections setting. By default it is set to the maximum value calculated using the following formula:
200 × <number_of_vCPUs_per_host>
For instructions on updating PostgreSQL settings at the cluster level, see this guide.
What is the maximum allowed number of connections per user?
By default, a cluster reserves 50 connections per host for each user. You can change this number in the Conn limit setting.
If the user’s connection limit is reached, new connection attempts will fail with the following error:
too many active clients for user (pool_size for user <username> reached <limit_value>)
For instructions on updating PostgreSQL settings at the user level, see this guide.
Why am I getting an error when trying to connect to a database from Looker Studio?
To connect from Looker Studio, you need to generate a client certificate file and a private key and specify them in the connection settings. For more information, see Connecting from Looker Studio.
How to ensure I am always connecting to the master host?
To connect to the current master host, use a special FQDN in the c-<cluster_ID>.rw.mdb.yandexcloud.net format. This FQDN supports read and write access.
Example command for connecting to the master host
psql "host=c-<cluster_ID>.rw.mdb.yandexcloud.net \
port=6432 \
sslmode=verify-full \
dbname=<DB_name> \
user=<username>"
How to ensure I am always connecting to the most up-to-date replica?
To connect to the most up-to-date replica, use a special FQDN in the c-<cluster_ID>.ro.mdb.yandexcloud.net format. This FQDN only supports read access.
Example command for connecting to a replica
psql "host=c-<cluster_ID>.ro.mdb.yandexcloud.net \
port=6432 \
sslmode=verify-full \
dbname=<DB_name> \
user=<username>"
If there are no active replicas in the cluster, this FQDN will point to the current master host.
How do I connect to the postgres database?
postgres is a system database. For security reasons, you cannot connect to system databases.
How do I get the postgres user's password?
For security reasons, the system does not permit obtaining the postgres user's password to connect to the database on their behalf.
Updating a cluster
Why did my cluster switch to the Updating status during an unscheduled backup?
Once the backup process is started, the cluster changes its status to Updating. You cannot cancel this operation. Please wait for it to complete.
The operation’s duration depends on a number of factors, including database size, cluster configuration, and the nature of the stored data. The average cluster restoration speed is approximately 100 MB/s.
Can I create two PostgreSQL databases at the same time?
You cannot perform multiple cluster operations simultaneously due to architectural constraints of the technologies used in Yandex Cloud.
How can I change the number of connections available for a user?
You can change the number of connections by updating the following settings:
- Conn limit: Maximum number of host connections per user. The default value is 50. The minimum value is 10.
- Max connections: Maximum number of connections reserved for all users. The default value is
200 × <number_of_vCPUs_per_host>. Note that this number includes 15 system connections. For example, with"max_connections": 100, you can reserve no more than 85 user connections per cluster host.
Can I change the host class (standard, memory-optimized, burstable) for an existing host?
Yes, you can do this by following the procedure in Changing cluster settings.
Can I change the disk type in an existing cluster?
Yes, you can. To do this, restore the cluster from a backup and specify the required disk type when configuring the new cluster.
Can I manage a cluster using SQL commands?
Cluster management via SQL commands has certain restrictions. For more information, see SQL command limits.
Can I create a database using SQL commands?
No, you cannot create a database via SQL. Managed Service for PostgreSQL clusters only support database creation via Yandex Cloud interfaces.
How to take a cluster out of read-only mode?
Follow the steps described in Recovering a cluster from read-only mode and Manually disable read-only mode for the cluster.
Cluster parameter settings
Is autovacuum enabled for all tables by default?
Yes, AUTOVACUUM is enabled for all tables by default.
Autovacuuming does not run at a specific time. Instead, it runs when a certain value specified in the settings is reached, for example, when the share of updated or deleted table records becomes equal to the Autovacuum vacuum scale factor.
For more information, see this PostgreSQL guide
What are the default values for LC_COLLATE and LC_CTYPE database settings?
The default settings for new databases are LC_CTYPE=C and LC_COLLATE=C. You cannot change these settings for the database created alongside the cluster. However, you can create a new database and specify the required values for it.
Can I change the LC_COLLATE and LC_CTYPE values?
Once a database is created, you cannot change its locale settings. However, you can:
- Create a new database with the required settings.
- Specify the collation locale (
LC_COLLATE) for the database objects:- When calling a function:
SELECT lower(t1 COLLATE "ru_RU.utf8") FROM test; - When creating or altering a table:
CREATE TABLE test (t1 text COLLATE "ru_RU.utf8");
- When calling a function:
Can I change the database owner?
Once a database is created, you cannot change its owner. An attemp to change the owner of a database created using Terraform by editing its owner setting will trigger the database recreation, resulting in data loss.
Moving and restoring a cluster
Can I restore a cluster backup to a running Managed Service for PostgreSQL instance in another cloud network?
Yes, you can switch to another cloud network when restoring a cluster from a backup.
Can I change the retention period for automatic backups?
You can set the retention period for automatic backups during cluster creation or modification.
Do I need the wal2json plugin if I am only doing data replication and not copying?
Yes, you need this plugin even if you do not copy data.
Can I download a database backup to my local machine?
While Yandex Cloud service does not support local backup downloads, you can use the pg_dump utility
How do I move a local PostgreSQL database dump to Yandex Cloud?
Follow the steps described in this Migrating databases tutorial.
How do I migrate a database or a table from one cluster to another?
You can migrate a database or a table using Data Transfer or pg_dump
For more information on using Data Transfer for migration, see Database migration.
How do I transfer data between clusters in different folders or clouds?
You can transfer data using Data Transfer or pg_dump
For more information on using Data Transfer for migration, see Database migration.
How do I move a cluster to another cloud?
You can move a cluster using Data Transfer or pg_dump
For more information on using Data Transfer for migration, see Database migration.
How do I restore a backup to an existing cluster?
You can only restore a backup to a new cluster.
How do I restore a cluster to the state of the selected backup?
You can only restore a backup to a new cluster.
Can I restore a single database from a backup?
No, you cannot restore a specific database. You can only restore the entire cluster with all its databases.
Users and roles
Can I migrate users from a PostgreSQL source cluster to a Managed Service for PostgreSQL destination cluster?
No, you cannot automatically migrate users from a third-party PostgreSQL cluster or Managed Service for PostgreSQL cluster to a Managed Service for PostgreSQL cluster. You will need to re-create the users in the target cluster.
How to create a role using SQL queries?
You cannot create a role using SQL queries.
In PostgreSQL, a role is a database user or group of users. In Managed Service for PostgreSQL, you can create a user only via the management console, Yandex Cloud CLI, Terraform, or API. For more information about creating users, see this PostgreSQL guide
You can assign user privileges, which decide the actions the user can perform with database objects.
High availability and load balancing
How to remove a host from the master selection process?
You can exclude a host from the master selection process during an automatic or manual failover. To do this, set up cascading replication by specifying a replication source for the host you want to exclude.
Warning
To ensure high availability during maintenance, your cluster must have at least one replica without a replication source.
Why do I get an error when setting up cascading replication?
Error message:
cluster should have at least 2 HA hosts to use cascade host
This error occurs if you specify a replication source for the only non-cascading replica.
To ensure high availability, your cluster must have at least one replica without a replication source. This replica will be promoted to master if the master host fails during maintenance.
To learn more about replication, see this article.
How to ensure I am always connecting to the master host?
To connect to the current master host, use a special FQDN in the c-<cluster_ID>.rw.mdb.yandexcloud.net format. This FQDN supports read and write access.
Example command for connecting to the master host
psql "host=c-<cluster_ID>.rw.mdb.yandexcloud.net \
port=6432 \
sslmode=verify-full \
dbname=<DB_name> \
user=<username>"
How to ensure I am always connecting to the most up-to-date replica?
To connect to the most up-to-date replica, use a special FQDN in the c-<cluster_ID>.ro.mdb.yandexcloud.net format. This FQDN only supports read access.
Example command for connecting to a replica
psql "host=c-<cluster_ID>.ro.mdb.yandexcloud.net \
port=6432 \
sslmode=verify-full \
dbname=<DB_name> \
user=<username>"
If there are no active replicas in the cluster, this FQDN will point to the current master host.
Why did the master and replicas swap roles?
This means the master has failed over to the replica. Automatic master failover guarantees cluster availability during maintenance or in the event of the master host failure.
To connect to the current master host, use a special FQDN.
Warning
Use master host special FQDN-based connections only for processes that can cope with database being unavailable for writing for up to 10 minutes.
Can I configure multi-master within a single cluster or between two clusters?
No, Managed Service for PostgreSQL does not support multi-master configuration.
For more details on high availability cluster configuration, see High availability managed databases (MDB).
How to configure load balancing so that all read requests are redirected to replicas?
As Managed Service for PostgreSQL does not provide load balancing, you need to configure it in your application backend. To send read requests to replicas, your application must first identify the master and replica hosts, e.g., by using libpq. For more information, see this PostgreSQL article
Alternatively, use a special FQDN pointing to the most up-to-date replica.
For more information, see High availability.
When does automatic failover occur?
The master host can automatically fail over to another host:
- During cluster updates.
- On master host failure.
- Upon cluster recovery.
- During maintenance.
Master failover ensures the cluster works correctly under the listed conditions.
Note
To ensure high availability, the cluster always has at least one replica without an explicitly defined replication source. This replica can take over as master when needed.
Monitoring and logs
Where can I track my disk space utilization to avoid exceeding the 95% limit triggering read-only mode?
You can monitor your disk space usage:
- In the management console using the cluster health monitoring tools.
- In Yandex Monitoring
that also allows you to set up alerts for specified metrics.
Are logs stored on the same disk as PostgreSQL data? How are they billed?
Logs are stored on separate disks from data and are rotated automatically. You can view log information using the following CLI command:
yc managed-postgresql cluster list-logs <cluster_ID>
Cluster log storage is free of charge.
What is the retention period for logs?
Cluster logs are stored for 30 days.
What are WALs and what is their purpose?
Write-Ahead Logs
For more details on how PostgreSQL works, refer to its official documentation
What does Cached mean in the RAM monitoring of a PostgreSQL cluster host?
Cached stands for cached data. Most operations are performed in RAM where the entire database working set is stored. Since caching occurs both for databases and the disk itself, the amount of cached data can exceed the storage size.
If application RAM consumption increases, some of the memory used for cache can be freed up.
For more details on disk data caching in Linux, refer to the following guides
How do I get alerts on critical PostgreSQL cluster metrics?
Use Yandex Monitoring
How do I set up an alert that triggers when a certain percentage of disk space is used?
Create an alert for the disk.used_bytes metric in Yandex Monitoring. This metric shows disk space utilization in the Managed Service for PostgreSQL cluster.
For disk.used_bytes, use the following recommended notification thresholds:
Alarm: 90% of disk spaceWarning: 80% of disk space
Thresholds values must be specified in bytes. For example, the recommended values for a 100 GB disk are as follows:
Alarm:96636764160bytes (90%)Warning:85899345920bytes (80%)
Error messages
Why do I get an error when using the TimescaleDB extension?
Error message:
SQL Error [0A000]: ERROR: functionality not supported under the current "apache" license
Hint: Upgrade your license to 'timescale' to use this free community feature.
This error occurs when you attempt to use a function available only in TimescaleDB Community Edition.
The community edition is distributed under the Timescale license (TSL)
The version installed in a Managed Service for PostgreSQL cluster is TimescaleDB Apache 2 Edition, which has reduced functionality compared to the Community Edition.
What should I do if I get a revocation check error when using PowerShell to obtain an SSL certificate?
Here is the full text of the error:
curl: (35) schannel: next InitializeSecurityContext failed: Unknown error (0x80092012)
The revocation function was unable to check revocation for the certificate
This indicates that the service was unable to verify the site’s certificate against the revocation list during the connection attempt.
To fix this error:
-
Make sure your corporate network policies are not blocking the verification.
-
Run the following command with the
--ssl-no-revokeflag.mkdir $HOME\.postgresql; curl.exe --ssl-no-revoke -o $HOME\.postgresql\root.crt https://storage.yandexcloud.net/cloud-certs/CA.pem
What should I do if I get an SSL is required error when connecting?
This error occurs because you are trying to connect to a cluster with a publicly accessible host. Such hosts require an SSL certificate to connect. You have the following options:
- Obtain an SSL certificate and add it to the application you use to connect.
- Disable public access to hosts and connect to the cluster from a VM located in the same cloud network.
What should I do if I get a too many active clients for user error when connecting?
An attempt to connect to a cluster host may fail with the following error:
too many active clients for user (pool_size for user <username> reached <limit_value>)
By default, a cluster reserves 50 connections per host for each user. If the user’s connection limit is reached, new connection attempts will fail.
Solution: Increase the connection limit in the Conn limit setting.
For instructions on updating PostgreSQL settings at the user level, see this guide.
Why do I get an error when connecting to a custom database?
An attempt to connect to a custom database may fail with the following error:
ERROR: odyssey: ce3ea075f4ffa: route for '<DB_name>.<username>' is not found
This error indicates that your connection settings contain an incorrect database name.
Why do I get an error when creating a dump with pg_dumpall?
You can get this error when creating a dump with pg_dumpall:
ERROR: odyssey: c16b9035a1f78: route for 'template1.<username>' is not found
This error occurs because pg_dumpall tries to export all databases, including both custom and system ones.
You cannot create a dump of all Managed Service for PostgreSQL databases at once. Instead, use pg_dump to dump each custom database individually, skipping the system ones.
Why do I get an error when connecting to the postgres database?
An attempt to connect to the postgres database may fail with the following error:
ERROR: odyssey: c76e2c1283a7a: route for 'postgres.<username>' is not found
This error occurs because postgres is a system database and connecting to it is prohibited by Managed Service for PostgreSQL. Specify a different database in your connection settings.
Why does my connection terminate with a terminating connection due to administrator command message?
A Managed Service for PostgreSQL cluster connection may be terminated with the following message:
FATAL: terminating connection due to administrator command
This message is not an error; it indicates that the session/transaction duration has exceeded the Session duration timeout setting (12 hours by default).
Why cannot I connect to cluster hosts?
An attempt to connect to a cluster’s host may fail with the following error:
could not translate host name "<regular or special FQDN>" to address: Name or service not known
This error occurs if public access to the host is restricted or if you are using a custom DNS server that cannot resolve domain names in the mdb.yandexcloud.net zone.
Solution:
-
Enable public access to your target host. When using a special FQDN, enable public access for the host associated with that FQDN.
Warning
Use master host special FQDN-based connections only for processes that can cope with database being unavailable for writing for up to 10 minutes.
-
We recommend that you enable public access for all cluster hosts. This will prevent connection errors during automatic master failover.
-
For custom DNS servers, configure DNS forwarding for the
mdb.yandexcloud.netzone.
Why cannot I stop a cluster?
Error message:
ERROR: rpc error: code = FailedPrecondition desc = Cluster has no backups
You cannot stop a cluster if it does not have any backups. To stop such a cluster, first create a backup for it.
Why do I get a max_connections is less than sum of users connection limit error when modifying a cluster?
This error may occur when downgrading a host class in a cluster if the sum of all user connection limits becomes less than the total cluster connection limit specified in Max connections.
Solution: First, reduce the per-user connection limits until their combined total is less than <Max_connections_value> — 15, and then lower the host class.
Why do I get an error when transferring data by creating and restoring a logical dump?
Restoring a logical dump may fail with one of the following errors:
ERROR: role "<source_username>" does not existERROR: must be member of role "<source_username>"
These errors occur because the target cluster lacks the user account or the user privileges that were used to create the logical dump in the source cluster.
To resolve these errors:
- In the target cluster, add a user with access to the migrated database and the same name as the user who created the logical dump in the source cluster.
- Restore the logical dump on behalf of this user or grant their privileges to another account you want to use to restore the logical dump.
What should I do if I get a replication slot already exists error during logical replication?
By default, the system creates a replication slot when you create a subscription. The replication slot already exists error means that the replication slot already exists.
You can resolve this error in one of the following ways:
- Link your subscription to an existing replication slot. To do this, add
create_slot = falseto your command for creating a subscription. - Delete the existing replication slot and try creating the subscription again.
Why do I get an extension... is not available error when migrating my database to Managed Service for PostgreSQL?
Error message:
extension "<extension_name>" is not available
This error may occur during a database migration to Managed Service for PostgreSQL using a script that attempts to install and use the PostgreSQL extension. The error occurs because PostgreSQL extensions cannot be managed via SQL in Managed Service for PostgreSQL clusters.
To avoid this error:
- For scripts and dumps in text format, remove any PostgreSQL extension creation commands from them.
- Install all required extensions in the target database using the Yandex Cloud interfaces.
Why do I get a must be owner of extension error when restoring a logical dump?
Restoring a logical dump may fail with the following error: ERROR: must be owner of extension.
The error is caused by the presence of PostgreSQL extension installation or update operations in the logical dump. In Managed Service for PostgreSQL clusters, you cannot manage extensions using SQL commands.
To resolve this error, do the following:
- Before restoring the dump, enable all required extensions in the target database.
- Remove any operations with extensions from the dump. For example, comment out the lines related to installing extensions.
- Repeat the logical dump recovery attempt.
Why do I get an error when setting up cascading replication?
Error message:
cluster should have at least 2 HA hosts to use cascade host
This error occurs if you specify a replication source for the only non-cascading replica.
To ensure high availability, your cluster must contain at least one replica without a defined replication source. This replica will be promoted to master if the master host fails during maintenance.
To learn more about replication, see this section.
Why do I get a cannot execute <SQL_command> in a read-only transaction error?
Error variations:
ERROR: cannot execute ALTER EXTENSION in a read-only transaction
ERROR: cannot execute CREATE TABLE in a read-only transaction
ERROR: cannot execute UPDATE in a read-only transaction
ERROR: cannot execute INSERT in a read-only transaction
Such errors may occur after master failover when you are connected to a read-only replica.
You can prevent these errors in one of the following ways:
-
Connect to the cluster using a special FQDN that always points to the current master.
Warning
Use master host special FQDN-based connections only for processes that can cope with database being unavailable for writing for up to 10 minutes.
-
When connecting, specify
target_session_attrs=read-writeand list all cluster hosts. This way, you will connect to the master host with read and write access.
For more details on connecting to the master host, see Connecting to a database.
What should I do if I see a too many connections for role "monitor" error in the logs?
The monitor user is reserved for monitoring purposes in the Managed Service for PostgreSQL cluster. You can ignore too many connections warnings for this user.
Why do I get an error when trying to install multiple extensions in the CLI?
Installing multiple extensions in the CLI may fail with one of these errors:
-
ERROR: accepts 1 arg(s), received 2This error may occur due to an incorrect command format.
Solution: Make sure to list the extensions with no spaces in between. Here is an example:
yc managed-postgresql database update db1 --cluster-id cat0adul1fj0******** --extensions cube,pg_logic,timescaledb -
ERROR: rpc error: code = InvalidArgument desc = Invalid extensions '<extension_name>', allowed extension: <extension_list>You may get this error if an extension in the list is incompatible with the PostgreSQL version in the cluster.
Solution: Check the compatibility of the extensions specified in the command in the list of supported extensions.
-
ERROR: rpc error: code = InvalidArgument desc = The specified extension '<extension_name>' is not present in shared_preload_librariesThis error may occur if the cluster does not contain the required shared library.
Solution: Check the shared library requirements in the list of supported extensions. To add the required library, when updating the PostgreSQL cluster settings, specify its name in the Shared preload libraries parameter.