Yandex.Cloud
  • Services
  • Why Yandex.Cloud
  • Pricing
  • Documentation
  • Contact us
Get started
Yandex Managed Service for PostgreSQL
  • Getting started
  • Step-by-step instructions
    • All instructions
    • Information about existing clusters
    • Creating clusters
    • Connecting to databases
    • Stop and start the cluster
    • SQL queries in the management console
    • Changing cluster and database settings
    • Connecting to DataLens
    • Managing PostgreSQL hosts
    • Database management
    • How to manage PostgreSQL extensions
    • Managing database users
    • Granting permissions and roles
    • Managing backups
    • Deleting clusters
    • Database migration to the Cloud
    • Creating a logical replica of Amazon RDS for PostgreSQL in Managed Service for PostgreSQL
  • Solutions
    • Creating a PostgreSQL cluster for 1C
  • Concepts
    • Relationship between service resources
    • Host classes
    • Network in Yandex Managed Service for PostgreSQL
    • Quotas and limits
    • Storage types
    • Backups
    • Assigning roles
    • Replication
    • Supported clients
  • Access management
  • Pricing policy
    • Current pricing policy
    • Archive
      • Before January 1, 2019
      • From January 1 to March 1, 2019
      • From March 1, 2019 to February 1, 2020
  • API reference
    • Authentication in the API
    • gRPC
      • Overview
      • BackupService
      • ClusterService
      • DatabaseService
      • ResourcePresetService
      • UserService
      • OperationService
    • REST
      • Overview
      • Backup
        • Overview
        • get
        • list
      • Cluster
        • Overview
        • addHosts
        • backup
        • create
        • delete
        • deleteHosts
        • get
        • list
        • listBackups
        • listHosts
        • listLogs
        • listOperations
        • move
        • rescheduleMaintenance
        • restore
        • start
        • startFailover
        • stop
        • streamLogs
        • update
        • updateHosts
      • Database
        • Overview
        • create
        • delete
        • get
        • list
        • update
      • ResourcePreset
        • Overview
        • get
        • list
      • User
        • Overview
        • create
        • delete
        • get
        • grantPermission
        • list
        • revokePermission
        • update
      • Operation
        • Overview
        • get
  • Questions and answers
    • General questions
    • Questions about PostgreSQL
    • All questions on the same page
  1. Concepts
  2. Replication

Replication

  • Selecting the master and a synchronous replica
  • Write sync and read consistency

Data in Managed Service for PostgreSQL clusters is replicated synchronously. A successful response to a write data request
is returned only when the data is written to the disk on both the master host and the priority replica. In the other cluster replicas, data is replicated asynchronously.

Due to limited resources, the b1.nano, b1.micro, b2.nano, and b2.micro class hosts are not replicated.

For more information about how replication works in PostgreSQL, see the DBMS documentation.

Selecting the master and a synchronous replica

The master host and synchronous replica are selected by priority, which you can set for a specific host.

In addition, you can configure cascading replication by explicitly assigning a source of replication for each host. The hosts with the set replication source cannot:

  • Become synchronous replicas.
  • Participate in the selection of a new master host.
  • Automatically switch to a new source of replication.

Write sync and read consistency

By default, the master and replica are kept in sync by syncing the Write-Ahead Log (WAL) (synchronous_commit = on). However, there's a delay between WAL delivery and applying it to the synchronous replica. During that delay, the synchronous replica may have data that's out-of-sync with the master.

If you want to ensure ongoing consistency of data reads between the master and synchronous replica, specify, in the cluster settings, the synchronous_commit = remote_write parameter. With this parameter value, a data write is not considered successful until the synchronous replica is ready to read the updated data. However, there is a disadvantage: write operations to the cluster will take longer.

For a detailed description of the synchronous_commit parameter, see the PostgreSQL documentation.

In this article:
  • Selecting the master and a synchronous replica
  • Write sync and read consistency
Language
Careers
Privacy policy
Terms of use
© 2021 Yandex.Cloud LLC