PostgreSQL cluster fault tolerance
By default, a PostgreSQL cloud database cluster consists of one master nodes. To provide fault tolerance to the cluster, you need to add to it replicas.
Master Node
By default, the cluster consists of one master node — the master. When connected to the master node, all operations are available: read (SELECT) and write (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 replicas and master node.
Replicas
Replicas are full copies of the master node. They are available only for reading data (SELECT).
The presence of replicas in the 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 over the role of the replica. The address of the master node will change.
If there are no replicas in the cluster, the cluster will be unavailable until the master node is restored. No data will be lost in this case.
We recommend failover clusters with lines or cue into existing clusters.
Change the number of lines
You can increase or decrease the number of replicas. If you change the number of replicas, the cluster continues to operate.
- In control panel go to Cloud platform → Databases.
- Open the cluster page → tab Settings.
- Click Scale up the cluster.
- 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.