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 master.
Read requests can be processed both on secondary replicas and the master, depending on the readPreference connection parameter.
Changing the master
If the master fails or is switched over manually, Yandex StoreDoc will automatically select a new master from the non-hidden hosts.
You can influence master selection in a Yandex StoreDoc cluster by configuring priorities for cluster hosts. The host with the highest priority will become a new master.
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 master, even if there are no other suitable hosts in the cluster. The maximum value is 1000. Only integer values can be used.