How to make a real-time copy of the database to another disk?
My database is very small, but WAL-logs are very large (many changes in time). I don't need 'Point-in-Time Recovery', I just need the latest version of the database. How to force a sql server to maintain an additional copy of the database to another disk in case the first disk lost data (hardware failure)?
-
Question seems to be about SQL Server. Question is tagged PostgreSQL. Which one are you really using?Mike Sherrill 'Cat Recall'– Mike Sherrill 'Cat Recall'2019年06月17日 13:27:19 +00:00Commented Jun 17, 2019 at 13:27
-
Postgresql in title. Postgresql is also sql server.user3324131– user33241312019年06月17日 14:38:35 +00:00Commented Jun 17, 2019 at 14:38
-
1"Postgresql is also sql server" is not idiomatic English. "PostgreSQL is also a SQL server" is idiomatic. The meanings are quite different.Mike Sherrill 'Cat Recall'– Mike Sherrill 'Cat Recall'2019年06月17日 14:48:30 +00:00Commented Jun 17, 2019 at 14:48
-
Ok, sorry for may poor english.user3324131– user33241312019年06月17日 15:04:03 +00:00Commented Jun 17, 2019 at 15:04
-
No need to apologize. Idiomatic English is hard.Mike Sherrill 'Cat Recall'– Mike Sherrill 'Cat Recall'2019年06月17日 15:07:23 +00:00Commented Jun 17, 2019 at 15:07
1 Answer 1
If the first database "loses data", it's liable to tell the second database to "lose data to match me". (Depends on exactly what you mean by "lose data".) So reduce the chances of your database losing data due to a single disk failure by storing the database on an array: RAID 1, RAID 5, RAID 6, or RAID 10. I recommend RAID 6.
It's not clear whether you've read the docs for PostgreSQL's High Availability, Load Balancing, and Replication. Streaming replication is probably worth looking at.
To mitigate the risk of "losing data", you need to be precise about losing data means. Mitigating the risk of disk failure is different than mitigating the risk of an application deleting data by accident.
-
Yes, I read this. As far as I understand, replication is only possible between a few servers. I have a local machine with one server.user3324131– user33241312019年06月17日 15:13:24 +00:00Commented Jun 17, 2019 at 15:13
-
I'm just worried about risk of disk failure.user3324131– user33241312019年06月17日 15:16:06 +00:00Commented Jun 17, 2019 at 15:16