Re: database backup
2002-11-27 16:04:16
On Wednesday 27 November 2002 15:47, Jerry wrote:
> I'd like to stop a mysql database for a backup runs,
> and start it back up after the backup.
Someone else has suggested using mysqldump which is fine, though the dumped
files are much bigger than the databases and depending on your database, this
may or may not be an issue.
Another option is to use mysqlhotcopy - from the docs
mysqlhotcopy is designed to make stable copies of live MySQL databases.
Here "live" means that the database server is running and
the database may be in active use. And "stable" means that
the copy will not have any corruptions that could occur if
the table files were simply copied without first being
locked and flushed from within the server.
so the procedure would be that in your script which calls amdump, you first
run mysqlhotcopy before doing the actual amdump. In your exclude list,
exclude the mysql data directories (because copying these active files is
likely to have bad results) but of course you won't include the directory to
which you have hotcopied the database files.
In the event of a restore, you just need to stop MySQL, copy the database
files from the hotcopied area to your MySQL data directory, and restart
MySQL.
This method has minimal service impact (mysqlhotcopy issues a write lock on
the tables whilst copying but endeavours to hold this lock for as short a
time as possible) and results in fewer bytes being backed up than with
mysqldump.
Regards,
Niall O Broin
|
|
|