Symptoms

Postgres fails to start on DB replica node. How to rebuild replication from scratch?

Examples of cases:

Incorrect WAL sequence stored on the SLAVE node.

/var/lib/pgsql/9.6/data/pg_log/:

[2019-03-11 02:39:18.583 -03] p=1658:5@1/0 c=@/: FATAL:  invalid memory alloc request size     1663074304
[2019-03-11 02:39:18.586 -03] p=1339:3@ c=@/: LOG:  startup process (PID 1658) exited with exit code 1
[2019-03-11 02:39:18.586 -03] p=1339:4@ c=@/: LOG:  terminating any other active server processes
[2019-03-11 02:39:18.596 -03] p=1339:5@ c=@/: LOG:  database system is shut down

OR

Postgresql hangs in recovery mode.

/var/lib/pgsql/9.6/data/pg_log/:

[2019-03-11 07:26:36.105 -03] p=20849:1@ c=@/: LOG:  database system was interrupted; last known up at 2019-03-11 07:22:09 -03
[2019-03-11 07:26:38.813 -03] p=20852:1@ c=[unknown]@172.20.234.64/[unknown]:[unknown] LOG:  connection received: host=172.20.234.64 port=37470
[2019-03-11 07:26:38.824 -03] p=20852:2@ c=oa_172_20_234_63@172.20.234.64/pba:[unknown] FATAL:  the database system is starting up

Resolution

The DB replica must be rebuilt. This task should be addressed to the responsible system or database administrator among the provider's staff members. Technical support does not cover database replication configuration and cannot provide any recommendations on this matter.

Internal content

Link on internal Article