Posts

Showing posts from September, 2023

Steps to enable archive log mode in Postgres database

  Step-1: Validate the archive mode status  postgres=# show archive_mode;  archive_mode --------------  off (1 row) postgres=# show archive_command;  archive_command -----------------  (disabled) (1 row) Step-2: Create the archive location  mkdir -p /var/lib/pgsql/14/archive Step3: Enable archive mode  postgres=# ALTER SYSTEM SET archive_mode to 'ON'; ALTER SYSTEM postgres=# ALTER SYSTEM SET archive_command TO 'cp %p /var/lib/pgsql/14/archive/archive%f'; ALTER SYSTEM postgres=# show archive_mode;  archive_mode --------------  off (1 row) postgres=# show archive_command;  archive_command -----------------  (disabled) (1 row) Step4: Set the standard parameter for better performance postgres=# alter system set wal_keep_size='500MB'; ALTER SYSTEM postgres=# alter system set archive_timeout='900s'; ALTER SYSTEM postgres=# alter system set max_wal_senders=10; archive_timeout: Forces a WAL switch after a predetermined period of time a...