How to bring files to / from filesystem to / from MySQL database?

The app I'm working in generates files dynamically using. This makes backup and synchronization between staging, development and production a real challenge. One way to get a smooth solution (if possible) is to have a script that, at the time of the database backup, can back up the dynamically created files inside the database, and during the restore, can pull that file out of the database and on the file system again.

I'm wondering if there is any available (paid or free) application that can be scripted to make this happen.

Basically, if I have

/usr/share/appname/server/dynamicdir
/usr/share/appname/server/otherdir/etc/resource.file

      

Then, taking the above examples and using a script, put them into the mysql database.

Please let me know if you need more information.

0


source to share


2 answers


Do you mean the application stores files as blocks in a MySQL database and / or creates many temporary tables? Or do you just want the temporary files - not themselves associated with the database - to be stored in MySQL as a backup?

I'm not sure if trying to use MySQL as a clean new broker for file backups is a good idea. If the application is already using it, that is one thing, and if not, then MySQL is not suitable here.



Anyway. If you are interested in taking over the filesystem at a point in time, the answer is to use LVM snapshots . You will probably have to rebuild your server so that your filesystems are on LVM and you will have enough free space for as many snapshots as you see fit.

I would recommend having a new mount point for these temporary application files only. If your MySQL tables are using InnoDB, a simple script to run mysqldump -single-transaction in the background and then the lvm snapshot process, you can keep them in sync to the second.

+1


source


... Should be trivial to accomplish using PHP, perl, python, etc., are you looking for someone to write this for you?



0


source







All Articles