U
U
User15822020-01-23 15:11:35
PostgreSQL
User1582, 2020-01-23 15:11:35

How to determine in the early stages that something has started to fail in PostgreSQL?

Good afternoon!
Tell me, please, are there any methods for checking the database and Postgres itself for errors?
Something like database server self-testing?
In particular, I ran into a situation when problems with service tables started, and I noticed this only when I got an error on the next backup.
The problem was that the memory card on which Postgres was running started to fail.
I agree that you can use not a memory card, but a hard drive, etc., but nothing lasts forever and is not perfect.
Therefore, I would like to be able to detect such errors earlier in order to be able to extract the data normally and either repair, but rather reinstall Postgres.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
ky0, 2020-01-23
@ky0

Nothing lasts forever and is not perfect, except for a cluster with a replica lagging by several hours and a clear backup plan.
Your case is not about postgres. To avoid problems with the file system, important databases are usually placed on fault-tolerant storage.

M
mayton2019, 2020-01-23
@mayton2019

If the storage medium is unreliable, then additional Hamming-type codes are added to it, which restore damaged bits after a failure. On 99% of normal media, this is implemented in hardware. If your flash drive fails or is not very reliable, it is advisable to buy a new one. If you still want to pick gold in the manure - look in the direction of the par2 utility manpages.org/par2 , it will increase the size of your backups by ten percent, but will guarantee fixing a few bits if it happens. It runs on top of a regular filesystem and its control codes will just be extra files side by side.
Whether and to check vosstanovistya a backup basically - it is impossible. Like in that philosophical thought - you can't know what pudding is until you've eaten it. Therefore, the integrity of the backup at the logical level can only be guaranteed by simulating its complete restoration in the database.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question