Yandex Cloud
Search
Contact UsTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • AI for business
    • Business tools
  • 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
© 2025 Direct Cursus Technology L.L.C.
Yandex Managed Service for MySQL®
  • Getting started
    • Resource relationships
    • High availability clusters
    • Network in Managed Service for MySQL
    • Quotas and limits
    • Storage in Managed Service for MySQL®
    • Backups
    • Replication
    • Maintenance
    • User permissions
    • MySQL settings
    • SQL command limits
    • Comparing MySQL® versions 5.7 and 8.0
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Public materials
  • Release notes

In this article:

  • Managing replication procedures
  • Recommended cluster configuration
  • Manual cluster configuration management
  • Selecting a master if the primary master fails
  • Use cases
  1. Concepts
  2. Replication

Replication in Managed Service for MySQL®

Written by
Yandex Cloud
Updated at October 30, 2025
  • Managing replication procedures
    • Recommended cluster configuration
    • Manual cluster configuration management
  • Selecting a master if the primary master fails
  • Use cases

Managed Service for MySQL® clusters use semi-sync replication: by default, the master waits for a transaction to be completed in at least one replica.

Note

You can change the number of replicas required for a transaction to complete in the Rpl semi sync master wait for slave count setting.

Managing replication proceduresManaging replication procedures

Recommended cluster configurationRecommended cluster configuration

Once you create a MySQL® cluster with multiple hosts, it contains one master host and replicas. Replicas use the master host as a replication source.

Here is an example of an auto replicated cluster configuration:

In this example, a master and two replicas are located in different availability zones. In which case:

  • Each transaction is saved to a minimum of two hosts.
  • The cluster remains available for two consecutive host failures in one of the availability zones.

If a replica and the master are located in different availability zones, the transaction commit latency cannot be less than the round-trip time (RTT) between data centers located in these availability zones. As a result, for single-thread writes with AUTOCOMMIT enabled, the cluster performance may drop considerably. For maximum performance, we recommend using multiple threads for write operations where possible, as well as disabling AUTOCOMMIT and grouping queries into transactions.

Managed Service for MySQL® clusters support automatic selection and failover to a new master. If the master host fails, one of its replicas becomes a new master.

For more information on master host selection, see Selecting a master if the primary master fails.

Manual cluster configuration managementManual cluster configuration management

With manual management, other cluster hosts may serve as replication sources for any cluster replica. Replicas that have their replication sources set manually are referred to as cascading replicas. Cascading replicas use asynchronous replication from a source host. Therefore, a cascading replica cannot become the master if the master host fails or is switched over manually.

If the source host is not responding, a cascading replica temporarily becomes the master until the source host is available again.

Note

A cluster of two hosts where one is cascading replica is not highly available.

Here is an example of cluster configuration with cascading replication and hosts in two availability zones:

Assigning a replication source for the cluster hosts allows you to:

  • Fully manage the replication process in the cluster without using automatic replication.
  • Configure cascading replication for a MySQL® cluster with a tree topology, in which some replicas are managed automatically using Managed Service for MySQL® tools and others manually. This will reduce the load on the master host's network.
  • Allocate some replicas for analytical load, since they will not become a master under any condition.

Selecting a master if the primary master failsSelecting a master if the primary master fails

If the master host fails, any of the cluster hosts available for replication may become a new master. To influence master selection in a MySQL® cluster, set your preferred priority values for the cluster hosts. The highest priority host will become the master. Or, in a cluster with multiple replicas of equal priority, the one lagging the least behind the master will be selected. Replicas lagging more than the value of the Mdb priority choice max lag setting (60 seconds by default) will be excluded from the selection.

You can set host priority:

  • When creating a cluster with the CLI, API, or Terraform.
  • When changing the host settings.

The lowest priority is 0 (default), while the highest one is 100.

You can also initiate master failover or assign this role to one of the replicas manually.

Use casesUse cases

  • Delivering data to Yandex Managed Service for Apache Kafka® using Yandex Data Transfer
  • Migrating data from Managed Service for MySQL® to Yandex MPP Analytics for PostgreSQL using Yandex Data Transfer
  • Migrating a database from Managed Service for MySQL® to a third-party MySQL® cluster
  • Migrating data from Yandex Managed Service for PostgreSQL to Managed Service for MySQL® using Yandex Data Transfer
  • Migrating a database from MySQL® to ClickHouse® using Yandex Data Transfer

Was the article helpful?

Previous
Backups
Next
Maintenance
© 2025 Direct Cursus Technology L.L.C.