Our DB servers are on VM, during planned server restart for system patch deployment our Master DB server crashed.

We have taken the clone of Primary Slave VM and restore the Master DB using last basebackup taken just before the patch deployment activity.

Backup was successfully restored but after that our pg_xlog location was changed to data directory, which was previously mapped to different mount point on the file system. Due to the said change our WAL archival is failing with below error message:

[85807-1] db=,user=,app=,client=LOG: archive command failed with exit code 1
[85808-1] db=,user=,app=,client=DETAIL: The failed archive command was: cp -i pg_xlog/00000007.history /Archive/00000007.history && scp pg_xlog/00000007.history postgres@Primary Slave IP:/Archive/00000007.history && scp pg_xlog/00000007.history postgres@Secondary slave ip:/Archive/00000007.history
cp: overwrite â/Archive/00000007.historyâ?
Permission denied, please try again.
Permission denied, please try again.
Received disconnect from Primary Slave port 22:2: Too many authentication failures
Authentication failed.
lost connection

And since WAL archival was not working our base backup is also failing with following error message.

transaction log start point: 10D/DA000028 on timeline 8
69577578/69577578 kB (100%), 1/1 tablespace
transaction log end point: 10D/DA911D20
pg_basebackup: base backup completed
tar: Cowardly refusing to create an empty archive
Try tar --help or tar --usage for more information.
du: cannot access âpg_archbackup_2020-05-10.tar.gzâ: No such file or directory
tar (child): /Backup/pg_online/2020-05-10/pg_archbackup_2020-05-10.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
tar: pg_archbackup_2020-05-10.tar.gz: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors

Please help in resolving the above mentioned issue.

  • I believe the cause is either lack of permissions in the new folders you are writing to, or you are trying to write to a folder or network location that does not exist, or is mapped with a different name. I have just got this idea from the error message you posted. – Marcello Miorelli May 10 '20 at 13:45
  • Use a different directory as a destination for WAL archives on the restored system. Your archive_command saved you from overwriting WAL archives of the original master server. – Laurenz Albe May 11 '20 at 11:15
  • I want to change my pg_xlog location back to the previous one which is on a different mount point. Please guide me through the procedure. Thanks in advance. – AKBAR ALI May 17 '20 at 12:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.