0

I have a server with Centos6 and Postgresql 9.2, I have set up a replica in postgresql to another server of the same characteristics, today in the morning I have an error in the archiver process on the primary server, the replica does not configure it I, I really do not have a lot of knowledge about this topic, yesterday I had to delete some archived files in the primary for lack of space but later I checked the replica creating some tables and they replicated to the secondary, I thought it was all right ... I would like to know how to verify that the replica is working and if not how I can resynchronize the secondary. Thank you very much in advance

4
  • What was the ERROR message?
    – jjanes
    Dec 15 '19 at 17:06
  • You deleted from the archive directory, or from the live pg_xlog directory?
    – jjanes
    Dec 15 '19 at 17:07
  • If the replica can't find the files it needs, it will leave messages in the replica server's database server's log file about it. Do you see such messages?
    – jjanes
    Dec 15 '19 at 17:09
  • Delete in the pg_xlog directory because I started running a full vacuum and generated many files that filled the partition, I don't know what happens if the archiver process is not running and my fear is losing the replica, if so, do you know how I could resynchronize? Thank you for such quick responses! ... I am somewhat worried here Dec 15 '19 at 18:15
1

Since you deleted from pg_xlog, not from the archive, your first concern should be that you might lose the master, not just the replica.

Cross your fingers, and immediately perform a checkpoint on the master.

If you get into the situation again where the archive process can't keep up and is threatening to fill up all space on the pg_xlog partition, rather than manually deleting from pg_xlog you should instead change archive_command to 'true'. (Or change it to copy to somewhere else which is faster than its current setting is, but still preserves the files. Make sure to then manually copy those files to their final, slow, destination once the emergency is over.)

As for saving the replica, please answer my other two questions, preferably by editing the question to incorporate that information.

3
  • WHAT !!! ... do not tell me that ... until now postgres has not stopped ... does it mean that it was not corrupted? Or could it be that despite deleting the files it keeps running? As I said, after deleting the files 1 or 2 hours later, I created a table with data and replicated ... can this be possible if the database is corrupt? As I do the checkpoint in the master ???, excuse the ignorance is that I do not usually work with postgres. Thanks for the support Dec 15 '19 at 20:09
  • 1
    If the master has successfully checkpointed since then, the master should be OK. Since the default checkpoint timeout is 5 minutes and the max is one hour (on 9.2), you should be good. The replica should also be good if it has already applied and made visible changes you made to master since the removal. It must have already received what it needed before you removed it. Sometimes you can do dangerous things and come out OK.
    – jjanes
    Dec 15 '19 at 20:48
  • Ufff !!! I do not know how much peace of mind this last comment ... but I do not see any archiver process in the system and in the log it goes out : LOG: checkpoint complete: wrote 978 buffers (0.2%); 0 transaction log file(s) added, 0 removed, 0 recycled; write=99.348 s, sync=0.031 s, total=99.402 s; sync files=161, longest=0.003 s, average=0.000 s FATAL: could not open archive status directory "pg_xlog/archive_status": No such file or directory LOG: archiver process (PID 566889) exited Dec 16 '19 at 13:30

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.