What's the difference between Heroku Postgres Continuous Protection and including Follower database for integrity and recovery

I am considering deploying an application to Heroku and a Postres Standard database plan. I am interested in ensuring data integrity and ensuring that my customer data can be lost if the database gets corrupted or some other similar problem. I also want to ensure a smooth recovery process. Therefore, I have the following questions:

  • First, I assume that with Continuos there is still a possibility that the database might get corrupted. It's true?

  • This provides more integrity, protection and ease of recovery if the database becomes corrupted: standard DB / Continuos protected or standard DB with successor DB.

  • If by accident the DB gets corrupted or there are problems with the integrity of the database, how does Heroku fix it (assuming the database is a "managed" service). Is this automated or do I need to work with manual support to fix it?

I would love to hear your thoughts on this. My experience in the past has been with MySQL, but not the Postgres I've heard of.

thank

+3


source to share


1 answer


Caveat: I have some experience with Postgresql, but I have no experience with Heroku per se.

What Geroku calls Real-Time Protection and Sequencing databases are implemented using Postgresql Continuous Archiving and Streaming Replication . They have provided a number of administrative tools and infrastructure around these functions to make them easier to use.

Both of these features take advantage of the fact that Postgresql records all updates it makes to databases in a write-write (WAL) log.

With continuous archiving, you take a complete copy of all base files in the database — this is called a baseline backup. It also collects all WAL files created by the database, both during and after the base backup was created. Note that you do not need to stop the database to make the base backup — this is a fairly unobtrusive process.

If the worst happens and the database needs to be restored from a backup, you simply restore the base dump, configure the database so it knows where to find the archived WAL files, and run it. It will then play the WAL files sequentially until it is fully updated.

Note that you can also stop playback earlier. This can be very helpful, as you will see in my answer to your first question:

  • First, I am assuming that with Continuos there is still the possibility that the database could be corrupted. It's true?

Yes of course. Database corruption can occur for a number of reasons: hardware failure, software error in the database, error in application, or even operator error.

One of the benefits of continuous archiving is that you can replay WAL files to a specific point in time so that you can efficiently rewind to the point just before the database corruption.



As mentioned above, the follower DB uses Postgresql's 'Streaming Replication' feature. With this feature, you restore the baseline backup to a different server, configure it to connect to the main database, and retrieve WAL files in real time as they are created. The follower is then updated with any changes made to the master.

  1. That provides more integrity, protection and ease of recovery if the database is damaged: standard DB / with Continuos protection or Standard DB with serial DB.

Ease of recovery is the difference.

If you have a follower DB, this is a hot standby - if the master is down for some reason, you can switch the application to the follower with minimal downtime. On the other hand, if you have a large database and need to restore it from the last baseline backup and then replay all the WAL files created since then - this can take a long time, even if it is a really large database.

Note also, however, that the subsequent database will be useless if your database is corrupted due to an administrator accidentally deleting the wrong table. After a few seconds, the table will be deleted in the successor. They look like lemmings crossing a rock. The same applies if your application is corrupting the database due to a bug or a hacker or whatever. Even with a successor, you should have a proper in-place backup, either a solid archive or a regular pg_dump.

  1. If the database is accidentally damaged or problems with the integrity of the database arise, how will Heroku be corrected (given that the database is "managed", the provision of services). Is it automated or do I have to work with fixing?

Their documentation indicates that premium plans provide automatic switching to another resource. This would be useful in the event of hardware or platform failure and most types of database failures, where the system could detect that the primary database went down and initiate a failover.

In the event that the database gets corrupted by the application itself (or by a hasty admin), I suspect that you will have to manually initiate a failover.

+2


source







All Articles