PostgreSQL cluster fault tolerance for 1C
By default, a Managed Database cluster PostgreSQL for 1C consists of one master node. To ensure cluster fault tolerance, you need to add replicas to it. In multi-node clusters, one node will be a master node, and the others will be replicas.
For example, if you created a three-node cluster, the cluster will have one master node and two replicas. If you add more nodes, they will be replicas.
When adding replicas, consider the node allocation type in the cluster.
Master node
By default, a cluster consists of one main node — a master node. When connecting to the master node, all operations are available: reading (SELECT) and writing (INSERT, UPDATE, DELETE and others).
All data changes on the master node are duplicated on the replicas. The replication process does not affect the operation of the replicas or the master node.
Replicas
Replicas are full copies of the master node. They are available for read-only data operations (SELECT). In PostgreSQL for 1C Managed Database clusters, one replica is always synchronous, and all subsequent replicas are asynchronous.
Having replicas in a cluster ensures its fault tolerance — if the master node stops working, its role will be taken over by one of the replicas, and the cluster will continue to operate normally. When the master node is restored, it will take on the role of a replica. At this point, the master node address will change.
An SLA applies to a cluster with replicas — we guarantee 99.95% write availability and 99.99% read availability.
If there are no replicas in the cluster, it will be unavailable until the master node is restored. Data will not be lost.
We recommend creating fault-tolerant clusters with replicas or adding replicas to existing clusters.
Node allocation type
The node allocation type in a cluster depends on:
- the presence of replicas in the cluster;
- type of pool where the cluster is located;
- the number of segments in the pool;
- the configuration line.
You can view the list of pools and segments in the Servercore Infrastructure table in the Locations: countries, regions, availability zones, pools, and data center addresses guide.
Four node allocation types are available:
- Single-Segment;
- Multi-Segment;
- Single-AZ;
- Multi-AZ
Single-Segment
Multi-Segment
Single-AZ
Multi-AZ
Nodes are placed in one segment of a single-zone pool. Applicable to:
- for clusters without replicas;
- for clusters with replicas that are located in pools with only one segment;
- clusters with replicas in the HighFreq and Dedicated configuration lines.
For example, you created a three-node cluster (one master node and two replicas) using the HighFreq configuration in the ru-2 pool. All nodes will be placed in one pool segment, for example, in ru-2c.
Change the number of replicas
You can increase or decrease the number of replicas. When changing the number of replicas, the cluster continues to run.
- In the Dashboard, on the top menu, click Products and select Managed Databases.
- Open the Active tab.
- Open the cluster page → Settings tab.
- Click Edit configuration.
- In the Fault tolerance block, in the Number of nodes field, specify the new number of replicas. If there are no free addresses in the subnet to which the cluster is connected, a replica cannot be added — each new replica occupies a new address in the subnet.
- Click Save.