Reputation: 116
I was going through the official documentation for database backup and restoration for MariaDB: https://mariadb.com/kb/en/full-backup-and-restore-with-mariabackup/
It asks for stopping the server in order to run the restoration using the --copy-back or --move-back option and starting it after the restoration is complete. I am trying to understand why the restart is necessary. Can we perform it without restart?
Upvotes: 2
Views: 974
Reputation: 562671
Yes, it's necessary for mysqld to be shut down to restore a physical backup.
There's no way to copy back all the data files atomically, and also synchronize with in-memory buffers.
Here's an analogy: have you ever been editing the same file with a colleague? (I don't mean Google Docs, I mean like a Word document or something like that.) If one of you wants to edit the file, you have to tell the other person to close it, right? Because if you try to save your edits, you'll clobber your colleague's recent edits, because your copy didn't include their latest edits.
It's like that analogy. In this case, mysqld has to "close" the database files so mariabackup can replace them with the restored database files.
Upvotes: 1