Answer the question
In order to leave comments, you need to log in
How to make a Postgres database fault-tolerant?
Good afternoon!
I am developing a web service.
The service was written in Java(Spring), front-end - Javascript, database Postgres 10.4
It's all spinning on Ubuntu 16.04
It is highly desirable that the service be available 24 hours 7 days a week.
The main purpose of the database is to store the data structure (which changes infrequently) and logging all operations
performed with the data (SQL database was chosen because it is convenient to work with data through a relational database, and the logs themselves also have a fairly branched structure, interconnected and you need to perform various tricky queries with JOIN, etc.).
Reliability and fault tolerance, if I understand correctly, will consist of several components:
- the reliability of hardware (including the Internet connection),
- the reliability of the database,
- the reliability of the service itself, which is running on the JVM.
In order not to create an unnecessarily large question, I would first like to understand how reliable the Postgres DBMS is.
In particular, I'm interested in how to properly ensure the reliability and non-failure operation of its work?
Planned events (to the best of my understanding of things):
- I plan to do a daily automatic backup of the database itself (using scripts at night),
Old backups will be deleted after a certain period of time.
- using some script or utility to monitor the availability of the database and, in case of availability problems, restart / start the DBMS itself.
Advise what else can be done to ensure the reliable operation of the database.
Perhaps there are some best-practices which operations, queries or their combinations are undesirable for the database and can lead to problems.
Answer the question
In order to leave comments, you need to log in
how to ensure the reliability and non-failure operation of its operation?
master-slave replication to the second server with postgres
Here, for example
https://postgrespro.ru/docs/postgresql/11/high-ava...
https://eax.me/postgresql-replication/
https://blog .gita-dev.ru/post/nastrojka-potokovoj-...
https://habr.com/ru/company/pgdayrussia/blog/326996/
No way.
You can only get closer.
Master-slave, for example, will help not to lose PostgreSQL data, but this does not mean that the system will correctly switch to full-fledged operation from the slave when the master fails. The decision to switch will have to be made manually.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question