Backup and restore in PostgreSQL
Suppose we have a postgresql in streaming replication mode. master server and hot-standby ready to replace their fallen comrades. When bad scenario, we just have to create a trigger file and switch our app to work with the new master. However, there may be times when legitimate changes were made crooked written a migration and ran to the master and slave server. For example, have been removed/changed data in terms of tables or the tables were not removed. From the point of view of the database everything is fine, but from a business point of view is a disaster. In this case, the proclamation of the hot hot-standby master, the procedure is clearly useless... For warning such a situation there are at least two options... the the to use a periodic backup with pg_dump funds; the to use a backup base backups and WAL archives. The first method is simple to implement and requires minimum effort for installation and maintenance. Put "pg_dump | lbzip2" in cron, and