Replication in Yandex StoreDoc
Replication in a Yandex StoreDoc cluster is enabled when there are two or more non-hidden hosts. Each replica host stores a copy of the same dataset.
Types of replicas in a Yandex StoreDoc cluster:
- Primary replica (master): Automatically selected from among non-hidden hosts and accepts all write requests.
- Secondary replicas: Asynchronously copy all changes from the primary replica.
Read requests can be processed both on secondary replicas and the primary replica, depending on the readPreference connection parameter.
Primary replica failover
If the primary replica fails or is switched over manually, Yandex StoreDoc will automatically select a new primary replica from among the non-hidden hosts.
You can influence the primary replica selection in a Yandex StoreDoc cluster by configuring priorities for cluster hosts. The highest priority host will become the new primary replica.
You can set the host priority using the YC CLI, API, or Terraform:
- When creating a cluster or a host in a cluster.
- When changing the host settings.
The default priority value of 1 represents the lowest priority. The minimum value is 0. A host with this priority level cannot become the primary replica, even for absence of other suitable hosts in the cluster. The maximum value is 1000. Only integer values can be used.