3

Running a LEMP stack on Ubuntu 16.04. Found plenty of great documentation for backing up WordPress:

  1. Export your database:

    mysqldump --add-drop-table -h mysql_hostserver -u mysql_username -p mysql_databasename
    
  2. Copy the webroot where WordPress is located:

    cp -a /var/www/nginx/example.com/. /home/$USER/WPBackup/
    

Can I backup the MySQL database and WordPress installation safely and effectively while LEMP is serving content?

It seems like it could be a bad idea to make a backup while the database and WordPress files are being accessed.

No where in the WordPress documentation do I see a mention of whether or not it is safe to backup a WordPress installation that is serving content. If I cannot serve content while I am backing up WordPress, I may have something of a problem on my hand, as any amount of downtime is bad news for myself and the clients I host websites for.

If I backup WordPress while LEMP is serving content, will the backup of my database and/or WordPress installation risk becoming corrupted while it is being created? If so, how else could I go about backup up a WordPress installation without downtime, however little, coming into the equation?

  • 1
    If all you are doing is a dump of the database and copying of the files, you are completely safe. The dump will increase your disk I/O for a period, however your database should still be able to serve queries to WP just fine. – closetnoc Jan 5 '18 at 19:50
1

It should be completely safe to backup WordPress during normal operations. In fact, some of the best backups available for WordPress run live on the instance and do minute to minute backups of all changes (VaultPress and similar). Invoked backups will usually just copy the WordPress database tables and also copy the wp-content folder to the indicated destination. The only thing you may notice is some performance issues on slow/shared servers but you shouldn’t see any issues on VPS or properly configured dedicated.

tl;dr Yes, it’s safe.

  • Like JCL said. Since you are doing a dump, it is effectively the same as a database read, just like when someone visits your site. – Steve Jan 7 '18 at 7:29
1

I have not looked deeply into the structure, but the only thing to worry about is if the site being edited. Perhaps a menu referencing a page, and the inconsistency if the page was created after the page table was backed up but before the menu table was.

But that will probably never happen...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.