Answer the question
In order to leave comments, you need to log in
How not to lose data after a power failure?
Events arrive at the server, they are written to a temporary buffer array, data from the array is sent little by little to the remote server. If a power failure occurs, the received but not sent events will be deleted. Check for new events in the buffer after 500 milliseconds. DB will probably be too much for this. Or can write the incoming events to a temporary file?
Answer the question
In order to leave comments, you need to log in
DB concept is extensible.
Option 3, depending on the criticality of the data:
1 - important data, like user transactions - DB with ACID - postgre/mysql/etc
2 - moderately important - redis/rabbitmq - if you have power outages more than once a day - it's quite normal, both save to disk periodically
3 - well, if some statistics, for example, where + -1000 records are not critical - do not care at all
Well, the server in a normal data center does not fall from electricity, yes.
You can use a queue (nsq, redis, ...).
Put incoming events in a queue, and send from the queue to a remote server. Then, in case of failures, your data will be on disk.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question