POSTGRESQL - WAL_LEVEL AND ARCHIVE_MODE OPTIONSThis is an in-depth explanation: 1. wal_level :Description : Establishes how much data is written to the Write-Ahead Log (WAL) for replication and recovery.Values :
wal_level = replica
OR
ALTER SYSTEM SET wal_level = 'replica';
SELECT pg_reload_conf();
2. archive_mode :Description : Allows or prohibits WAL file archiving for PITR and long-term storage. VALUES :
archive_mode = on
archive_command = 'cp %p /path/to/archive/%f'
OR
ALTER SYSTEM SET archive_mode = 'on';
ALTER SYSTEM SET archive_command = 'cp %p /path/to/archive/%f';
SELECT pg_reload_conf();
Relationship Between wal_level and archive_mode :Archive_mode requires wal_level to be set to at least replica. With WAL archiving, the minimal level is incompatible. WAL files can be utilized for Point-in-Time Recovery (PITR) and are archived once they are finished when both are enabled. Preserving a database modification history. Validation : To check the current values:
SHOW wal_level;
SHOW archive_mode;
SHOW archive_command;
This configuration ensures reliable backup and replication options in PostgreSQL.Next Topic » (archive_command with File Formats WAL Archival Process) |