Reputation: 373
Should i need to stop Apache and MySQL servers before backup? Or can I make while they are working?
Under one computer's virtual host, there are numerial sites running. I am asking for general backup requirements and best way to do them. And if wee need to be offline or not.
Upvotes: 1
Views: 2603
Reputation: 27866
For PHP files you dont need backup. Use subversion, cvs, git or whatever versioning system you want to keep copies of your files. Keep SVN outside of production server.
For Apache, you need a one time backup of the config files, if you modified it a lot. Otherwise is not something that you backup on daily bases. If you are referring to the files that Apaches handles, like user uploaded images and stuff, do a copy sh script, attach it to cron and run it as often as you like. You dont have to stop the server for this.
Now MYSQL. This is the most tricky as it depends on how your tables are stored. InnoDB are stored in a big file together unless some directives are specified. MyIsam tables are just regular files that you can copy directly. If you have transactions and foreign keys than making backups is a little more complicated, because you want to keep database integrity. In that case you either stop the server, do the backup and restart, either like others were saying set up replication and do the backup on a slave, which you can stop without interrupting activity. I do backup a night backup of a database that is now 4GB without stopping the server.
Upvotes: 1
Reputation: 8380
You could setup a MySQL replication and backup what's on the slave, that way, you won't take your production database down.
Upvotes: 2
Reputation: 11308
Normally, when you need a back up, you either have to stop MySQL or issue a read lock on your MySQL tables in order to get a correct and safe backup; because otherwise, you can end up with an inconsistent backup data. This tutorial, however, explains how to get back up MySql Databases without interrupting the database.
Key Idea: Stop the slave server and then take the backup of the server. Once backup is done we will start the slave server again and it will catch up with the mysql master server and no data will be lost.
Secondly, you don't need to stop your application server (Apache) during back up process.
Upvotes: 1