Yandex Cloud
Search
Discuss with expertTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
    • Cloud Interconnect
    • Cloud Backup
    • Cloud Registry
    • Yandex AI Studio
    • Compute Cloud
    • Object Storage
    • Managed Service for Kubernetes®
    • Yandex BareMetal
    • Smart Web Security
    • Security Deck
    • Managed Service for PostgreSQL
    • Managed Service for ClickHouse®
    • Monium
    • Cloud CDN
    • Network Load Balancer
    • Virtual Private Cloud
    • Cloud DNS
    • Application Load Balancer
    • Yandex Cloud Video
    • Stackland
    • Yandex Cloud Router
    • Yandex Managed Service for Trino
    • Managed Service for MySQL®
    • Managed Service for Valkey™
    • Managed Service for Apache Spark™
    • Yandex StoreDoc
    • Managed Service for OpenSearch
    • Managed Service for Apache Kafka®
    • Data Transfer
    • Yandex MPP Analytics Engine for PostgreSQL
    • Yandex Managed Service for Apache Airflow®
    • Data Processing
    • Yandex MetaData Hub
    • Managed Service for YDB
    • Managed Service for Sharded PostgreSQL
    • Managed Service for YTsaurus
    • Yandex WebSQL
    • DataLens
    • Yandex Search API
    • SpeechSense
    • SpeechKit
    • DataSphere
    • Vision OCR
    • Translate
    • Yandex Identity Hub
    • Key Management Service
    • Certificate Manager
    • Yandex Lockbox
    • Audit Trails
    • SmartCaptcha
    • Cloud Desktop
    • Yandex SIEM
    • SourceCraft Code Assistant
    • Container Registry
    • Managed Service for GitLab
    • Managed Service for Prometheus®
    • Cloud Functions
    • API Gateway
    • Yandex Cloud Postbox
    • Message Queue
    • IoT Core
    • Data Streams
    • Serverless Containers
    • Cloud Notification Service
    • Yandex Query
    • Identity and Access Management
    • Yandex Cloud Console
    • Resource Manager
    • Yandex Cloud Billing
    • Yandex Cloud Quota Manager
    • Cloud Apps
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex Managed Service for PostgreSQL
  • Getting started
    • All guides
      • Pre-configuration
      • FQDNs of hosts
      • Connecting from applications
      • Code examples
  • Access management
  • Inspections and recommendations
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Public materials
  • Release notes

In this article:

  • Getting a host FQDN
  • Special FQDNs
  • Current master
  • Most recent replica
  • Aliases
  • Cluster alias
  • Host aliases
  • Selecting an FQDN and cluster connection method
  1. Step-by-step guides
  2. Connection
  3. FQDNs of hosts

FQDNs of PostgreSQL hosts

Written by
Yandex Cloud
Updated at October 6, 2026
View in Markdown
  • Getting a host FQDN
  • Special FQDNs
    • Current master
    • Most recent replica
  • Aliases
    • Cluster alias
    • Host aliases
  • Selecting an FQDN and cluster connection method

To connect to a host, you need its fully qualified domain name (FQDN). You can use the FQDN of a particular host in the cluster or a special FQDN always pointing to the current master host or the most recent replica.

Here is a host FQDN example:

rc1a-goh2a9tr********.mdb.yandexcloud.net

Getting a host FQDNGetting a host FQDN

There are several ways to get a PostgreSQL host's FQDN:

  • Look up the FQDN in the management console:

    1. Navigate to the cluster page.
    2. Navigate to Hosts.
    3. Copy the Host FQDN column value.
  • In the management console, copy the cluster connection command (it contains the host’s FQDN). To get this command, navigate to the cluster page and click Connect.

  • Get the list of cluster hosts using the CLI or API.

Special FQDNsSpecial FQDNs

Managed Service for PostgreSQL provides the following special FQDNs:

  • Current master FQDN
  • FQDN of the most recent replica

In multi-host clusters, special FQDNs may temporarily point to the old host, even if it has switched its role (e.g., from master to replica). If using a special FQDN which points to the current master, some write requests may fail if routed to the replica. This is because it takes time to update DNS records for special FQDNs. If your write request returns an error, repeat it later.

Warning

If automatic failover promotes a host without public access to master or most recent replica, you will not be able to connect to that host from the internet. To avoid this, enable public access for all cluster hosts.

Current masterCurrent master

An FQDN in c-<cluster_ID>.rw.mdb.yandexcloud.net format always points to the current master host in the cluster. You can get the cluster ID from the folder’s cluster list.

When connecting to this FQDN, you can perform read and write operations.

Tip

To reduce latency and mitigate risks during master failovers, we recommend setting the master manually.

Most recent replicaMost recent replica

An FQDN in c-<cluster_ID>.ro.mdb.yandexcloud.net format points to the replica that is most up-to-date with the current master. You can get the cluster ID with the list of clusters in the folder.

Specifics:

  • When connecting to this FQDN, you can only perform read operations.
  • If there are no active replicas in the cluster, this FQDN will point to the current master host.
  • Replicas with a manually configured replication source cannot be selected as most up-to-date replicas when using this FQDN.

AliasesAliases

With aliases, you can access the master, most recent replica, or each particular host of your Managed Service for PostgreSQL cluster using a stable, human-readable name no matter what their internal FQDNs are. Aliases are user-defined and can be used alongside regular and special FQDNs.

Cluster aliasCluster alias

A cluster alias always points to the current master host in the Managed Service for PostgreSQL cluster. It has the following format:

c-<short_name>-pg-<folder_ID>.rw.mdb.yandexcloud.net

Where <short_name> is a name set by the user when creating the alias.

A cluster alias must be unique within the folder. You can assign only one alias per cluster.

With cluster aliases, you can switch workloads from one cluster to another, e.g., after restoring from a backup. To do this, simply reassign the alias to the new cluster, no application-side updates required.

Warning

In multi-host clusters, special FQDNs may temporarily point to the old host, even if it has switched its role (e.g., from master to replica). If using a special FQDN which points to the current master, some write requests may fail if routed to the replica. This is because it takes time to update DNS records for special FQDNs. If your write request returns an error, repeat it later.

Host aliasesHost aliases

An alias pointing to a specific cluster host has the following format:

h-<host_short_name>-pg-<folder_ID>.mdb.yandexcloud.net

Where <host_short_name> is a name set by the user when creating the host alias.

Each host alias must be unique within the folder. You can assign only one alias per host.

Selecting an FQDN and cluster connection methodSelecting an FQDN and cluster connection method

To connect to a cluster, you can use the following:

  • Host FQDNs.
  • Special FQDNs.
  • Aliases.

If the cluster consists of several hosts, keep in mind that the current master can become a replica at any moment, and vice versa.

Warning

If automatic failover promotes a host without public access to master or most up-to-date replica, that host will be unreachable from the internet. To avoid this, enable public access for all cluster hosts.

Use one of the following methods to connect to the master host with read and write access:

  • Connect using the special FQDN pointing to the current master.

    After a master failover, this FQDN may temporarily point to the previous master, now a replica, due to the time required for the DNS record to update.

    Therefore, applications using this FQDN must be designed to handle temporary master unavailability. For example, they should retry write requests after a short delay.

    Connection example

    In this example, we use the c9qash3nb1v9******** cluster ID:

    psql "host=c-c9qash3nb1v9********.rw.mdb.yandexcloud.net \
          port=6432 \
          sslmode=verify-full \
          dbname=<DB_name> \
          user=<username>"
    
  • Connect by listing all cluster hosts and specifying target_session_attrs=read-write.

    Connection example

    Here, we list all the cluster’s hosts.

    The host IDs are rc1a-be***.mdb.yandexcloud.net, rc1b-5r***.mdb.yandexcloud.net, and rc1d-t4***.mdb.yandexcloud.net:

    psql "host=rc1a-be***.mdb.yandexcloud.net,rc1b-5r***.mdb.yandexcloud.net,rc1d-t4***.mdb.yandexcloud.net \
          port=6432 \
          sslmode=verify-full \
          dbname=<DB_name> \
          user=<username> \
          target_session_attrs=read-write"
    

Use one of the following methods to connect to the host with read access:

  • Connect using a special FQDN pointing to the most up-to-date replica.

    Connection example

    In this example, we use the c9qash3nb1v9******** cluster ID:

    psql "host=c-c9qash3nb1v9********.ro.mdb.yandexcloud.net \
          port=6432 \
          sslmode=verify-full \
          dbname=<DB_name> \
          user=<username>"
    
  • Connect by listing all cluster hosts and specifying target_session_attrs=any.

    Connection example

    Here, we list all the cluster’s hosts.

    The host IDs are rc1a-be***.mdb.yandexcloud.net, rc1b-5r***.mdb.yandexcloud.net, and rc1d-t4***.mdb.yandexcloud.net:

    psql "host=rc1a-be***.mdb.yandexcloud.net,rc1b-5r***.mdb.yandexcloud.net,rc1d-t4***.mdb.yandexcloud.net \
          port=6432 \
          sslmode=verify-full \
          dbname=<DB_name> \
          user=<username> \
          target_session_attrs=any"
    

Note

You can use the target_session_attrs setting when connecting via a client utilizing the libpq library.

Support for the read-write value in this setting was introduced in libpq version 10.

How to update the library version used by psql
  • For Debian-based Linux distributions, install the postgresql-client-10 package or a newer version from the official APT repository (or another source of your choice).
  • For RPM-based operating systems, use the PostgreSQL distribution from the yum repository.

Was the article helpful?

Previous
Pre-configuration
Next
Connecting from applications
© 2026 Direct Cursus Technology L.L.C.