This will back up both site's files and database, so we can have a good night sleep.
1. Back up
The easy way to backup Drupal is to run Drush commands inside Drupal Root (The installed directory of Drupal on your Linux host), for me this is folder: /var/www/drupal, let move into Drupal root on your host
$ cd /var/www/drupal
Back up the site’s database and files with this command, we have the output back up file in this command line too:
$ drush archive-dump --destination=/var/backup/drupal_20140306_17.tar.gz
After backup finish, explore the tar file drupal_20140306_17.tar.gz, we can see database script and files of the site.
And the MANIFEST.ini content here, so that we can recognize that db script, files, back up information is correct.
[Global]
datestamp = "1394100202"
formatversion = "1.0"
generator = "Drush archive-dump"
generatorversion = "6.2.0"
archiveformat = "platform"
[default]
docroot = "/var/www/drupal"
sitedir = "sites/default"
files-public = "sites/default/files"
database-default-file = "drupal2.sql"
database-default-driver = "mysql"
So that is the back up file to be restored later if we get problem with our Drupal site.
2. Restore
Now we can try to restore the Drupal site from backup file, in the restore command we have backup file, restored destination, database credential information.
$ sudo drush archive-restore /var/backup/example.com.tar.gz \ --destination=/var/www/example.com \ --db-su=root --db-su-pw=password --overwrite
Parameters:
--db-su: database admin account.
--db-su-pw: database admin password
--overwrite: overwrite restoration.
Just wait for the restoration finish, and you are back with your Drupal.
No comments:
Post a Comment