I have an application running on Jelastic and I'm searching for a backup solution. I found this doc about Master-Slave replication.
From what I understand I can have a secondary environment whit a copy of my database in either synchronous or asynchronous way, meaning that the changes to my database will happen at the same time, or queued up and written later.
But let's say I accidentally screwed up and deleted a database or my host has a problem and has to restore a backup, and the only one available is from yesterday (happened to me this week...).
If i delete the database and the changes happen at the same time, I'll lose everything on both environments, or should I use a cron and DUMP to backup my slave database hourly?
If anyone has a better backup solution I'll take it gladly.
The most simple solution in your case is using cron.
Following this instruction you can easily schedule the automatic backup of a MySQL or MariaDB database.
A. Setting up backups
In the opened file you'll see three samples of the cron parameters configurations:
0 1 * * * /var/lib/jelastic/bin/backup_script.sh -m dump -u USER -p PASSWORD -d db1[,db2,db3....]
0 2 * * * /var/lib/jelastic/bin/backup_script.sh -m dump -u USER -p PASSWORD -d db -t table1[,table2,table3....]
0 3 * * * /var/lib/jelastic/bin/backup_script.sh -m dumpall -u USER -p PASSWORD
Choose the one you need and specify your custom configurations:
For example, if you want to backup your database every 10 minutes with a help of the default script, then the string can be as following:
B. Checking backups
C. Download Backup
D. Restore Database
Access phpMyAdmin with the credentials you've got after adding DB node.
Navigate to the Import tab and browse the backup .bz2 file. Click Go.
That's all! Now you can be sure that all your data is being saved periodically and can be restored or reused.
If you need more assistance, do not hesitate to contact us or support team of the chosen hosting provider (click "Help" > "Contact Support" on the top right corner of Jelastic dashboard).
Good luck and have a nice day.