Middle — Middle+
What are the consequences in PostgreSQL when the main node of the system fails?
sobes.tech AI
Answer from AI
The following consequences occur in PostgreSQL when the primary node fails:
- Loss of write capability: The primary node is responsible for handling all write operations. When it fails, writes become impossible until failover to a standby node.
- Failover to standby node: If replication and automatic failover mechanisms are configured (e.g., using Patroni, repmgr, or other tools), one of the replicas can become the new primary.
- Potential data loss: If replication is configured with delay or without synchronous mode, some of the latest transactions may be lost.
- Temporary service unavailability: During failure detection and failover, the database may be unavailable.
- Recovery required: In the absence of automatic failover, an administrator must manually promote a new primary node and configure replication.
Example: If synchronous replication is used, upon primary node failure, a replica that has received all transactions can become the new primary without data loss.