0

I am writing a script to snapshot EBS volumes on AWS. One of the volumes contains the data for a mysql database. I am aware that I need to somehow stop data being written to the database while the snapshot is initiated so that the data is consistent but I cannot obtain a lock on all the tables on the database.

Will using xfs_freeze without a lock on the tables suffice for a consistent solution?

Ty

1 Answer 1

0

no, because mysql might still have data in it's own buffers, that the filesystem couldn't possibly know about.

the proper method is to "flush tables with read lock", THEN create a filesystem snapshot, after which you can immediately release the lock again.

why can't you obtain a lock?

2
  • @r001 I am trying to do all this in PHP ;) and its not very easy to get a lock on all tables in the database.
    – mrwooster
    Dec 21, 2010 at 8:18
  • @mrwooster Sure it is. In PHP, mysqli_query("FLUSH TABLES WITH READ LOCK"); then take the snapshot by using exec() then mysqli_query("UNLOCK TABLES"); It's actually very easy.
    – utdrmac
    Dec 2, 2018 at 6:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .