Drush 8 でのDrupal バックアップとリストアについて
Drushのバージョン 8.1.18 の場合
バックアップ
drush archive-backup もしくは drush archive-dump
Backup your code, files, and database into a single file.
Examples:
drush archive-dump Write an archive containing 3 sites in it.
default,example.com,foo.com
drush archive-dump @sites Save archive containing all sites in a multi-site.
drush archive-dump default Save archive to custom location.
--destination=/backups/mysite.tar
drush archive-dump Omits any .git directories found in the tree as well as
--tar-options="--exclude=.git sites/default/files.
--exclude=sites/default/files"
drush archive-dump Placeholder %files is replaced with the real path for the
--tar-options="--exclude=%files" current site, and that path is excluded.
Arguments:
sites Optional. Site specifications, delimited by commas. Typically,
list subdirectory name(s) under /sites.
Options:
--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 8.1.18.
--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. Default is --no-overwrite.
--pipe Only print the destination of the archive. Useful for scripts
that don't pass --destination.
--preserve-symlinks Preserve symbolic links.
--skip-tables-key A key in the $skip_tables array. @see example.drushrc.php.
Optional.
--skip-tables-list A comma-separated list of tables to exclude completely.
Optional.
--structure-tables-key A key in the $structure_tables array. @see example.drushrc.php.
Optional.
--structure-tables-list A comma-separated list of tables to include for structure, but
not data. Optional.
--tables-key A key in the $tables array. Optional.
--tables-list A comma-separated list of tables to transfer. Optional.
--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 archive-restore
drush help archive-restore
Expand a site archive into a Drupal web site.
Examples:
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.
example.com
drush archive-restore ./example.tar.gz Restore archive to a custom location.
--destination=/var/www/example.com/docro
ot
drush archive-restore ./example.tar.gz Restore archive to a new database (and customize settings.php
--db-url=mysql://root:pass@127.0.0.1/dbn to point there.).
ame
Arguments:
file The site archive file that should be expanded.
site name Optional. Which site within the archive you want to restore.
Defaults to all.
Options:
--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=<mysql://root:pass@host/db> 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. Default
is --no-overwrite.
--tar-options Options passed thru to the tar command.
Aliases: arr