Answer the question
In order to leave comments, you need to log in
How to secure a database from crashes?
I am developing a program that will collect data in the database, so far I am focusing on MySQL.
The database on the ssd drive will store both raw data and calculation results.
At the same time, emergency power off is a frequent and unrecoverable specificity of work.
Is there any way to increase the resistance of the database to sudden power outages?
Loss of some recent data is acceptable, but damage to the database is unacceptable; after rebooting and restarting the software, work should continue.
Perhaps there are some specific database settings or strategies for working with the database that you need to follow?
UPD
This is a relatively portable device powered by an outlet, no battery power is provided.
And it is guaranteed to be accidentally pulled out of the socket during operation.
Answer the question
In order to leave comments, you need to log in
Almost any modern database writes WAL and fsyncs everything important. The worst thing that happens with a sudden shutdown is that what is not added to WAL is lost.
There are a number of jokes with mysql - you need to read its docks, not all of its storage engines can in wal.
Replication to where the electricity is not turned off
upd:
Another option is a journaled file system and everything is written to disks strictly synchronously. No caches or anything like that. Yes, it's very slow.
But with frequent emergency shutdowns, the equipment will not last long.
Such a configuration does not have the right to be called a database. I join all speakers. I'll just add that the portable device should write operation logs. To perform debriefing and record what was done. It is possible with rotation. And the database should lie separately. On reliable remote servers.
MySQL is not really a DBMS. This is a prefabricated Lego constructor in which each table individually determines its own level of fault tolerance (the so-called engine). Therefore, there is no point in discussing the reliability of MySQL without discussing how each table was created. In general - nothing can be said about reliability.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question