I’m developing a webshop using Java. I am using JPA to handle my data and store it in a database. Now I’m concerned with the scenario of losing any data. What is a best practice to prevent this?
Should I write changes to a local and a remote database using to EntityManagers? I’m using a VPS, would this result in a securityleak as I would need to transfer the data over the internet?
I don’t think a backup to a SQL-file or some simular option would suffice, as I might lose a recently placed order this way.
Thanks in advance.
If you want to prevent data loss due to hardware or database failure, the most obvious solution is to use a database product that has replication or hot-standby capability built in.
Data that has been transferred to a remote location that you don’t control would be a security concern, but the transfer itself should not be a concern. It is simple to secure the network connection used to transfer the data. Any decent database system will support SSL / TLS connections.
The problem with a simple backup system is that any updates made since the last completed backup may be lost.