Drupal 7. Backup через Drush

Бекапим сайт на Drupal 7 с применением drush


drush arb

готово, папка с бекапом будет лежать в ~/drush-backups/archive-dump
файл бекапа *.tar.gz с базой и файлами


drush help arb
Backup your code, files, and database into a single file.

 drush archive-dump                        Write an archive containing 3 sites in it.                                                         
 drush archive-dump @sites                 Save archive containing all sites in a multi-site.                                                 
 drush archive-dump default                Save archive to custom location.                                                                   
 drush archive-dump                        Omits any .git directories found in the tree as well as sites/default/files.                       
 drush archive-dump                        Placeholder %files is replaced with the real path for the current site, and that path is excluded. 

 sites                                     Optional. Site specifications, delimited by commas. Typically, list subdirectory name(s) under /sites.

 --description                             Describe the archive contents.                                                                                                
 --destination                             The full path and filename in which the archive should be stored. If omitted, it will be saved to the drush-backups directory 
                                           and a filename will be generated.                                                                                             
 --generator                               The generator name to store in the MANIFEST file. The default is "Drush archive-dump".                                        
 --generatorversion                        The generator version number to store in the MANIFEST file. The default is 7.0-dev.                                           
 --no-core                                 Exclude Drupal core, so the backup only contains the site specific stuff.                                                     
 --overwrite                               Do not fail if the destination file exists; overwrite it instead.                                                             
 --pipe                                    Only print the destination of the archive. Useful for scripts that don't pass --destination.                                  
 --preserve-symlinks                       Preserve symbolic links.                                                                                                      
 --tags                                    Add tags to the archive manifest. Delimit multiple by commas.                                                                 
 --tar-options                             Options passed thru to the tar command.

Aliases: ard, archive-backup, arb

Восстановление из бекапа

drush arr example.tar.gz


drush help arr
Expand a site archive into a Drupal web site.

 drush archive-restore ./example.tar.gz    Restore the files and databases for all sites in the archive.                   
 drush archive-restore ./example.tar.gz    Restore the files and database for example.com site.                            
 drush archive-restore ./example.tar.gz    Restore archive to a custom location.                                           
 drush archive-restore ./example.tar.gz    Restore archive to a new database (and customize settings.php to point there.). 

 file                                      The site archive file that should be expanded.                                
 site name                                 Optional. Which site within the archive you want to restore. Defaults to all.

 --db-prefix                               An optional table prefix to use during restore.                                                                               
 --db-su                                   Account to use when creating the new database. Optional.                                                                      
 --db-su-pw                                Password for the "db-su" account. Optional.                                                                                   
 --db-url=      A Drupal 6 style database URL indicating the target for database restore. If not provided, the archived settings.php is used. 
 --destination                             Specify where the Drupal site should be expanded, including the docroot. Defaults to the current working directory.           
 --overwrite                               Allow drush to overwrite any files in the destination.                                                                        
 --tar-options                             Options passed thru to the tar command.

Aliases: arr