Skip to content

Latest commit

 

History

History
34 lines (22 loc) · 1.27 KB

backup-db.md

File metadata and controls

34 lines (22 loc) · 1.27 KB

We recommend creating a backup of your project before an upgrade. Use the following steps to back up your Integration, Staging, and Production environments.

{:.procedure} To back up your Integration environment database and code:

  1. Create a local backup of the remote database.

    magento-cloud db:dump

    {:.bs-callout-info} The magento-cloud db:dump command runs the mysqldump command with the --single-transaction flag, which allows you to back up your database without locking the tables.

  2. Back up code and media.

    php bin/magento setup:backup --code [--media]

    Optionally, you can omit [--media] if you have a large number of static files that are already in source control.

{:.procedure} To back up your Staging or Production environment database before deploying:

  1. Use SSH to log in to the remote server.

  2. Create a database dump. To choose a target directory for the DB dump, use the --dump-directory option.

    vendor/bin/ece-tools db-dump

    The dump operation creates a dump-<timestamp>.sql.gz archive file in your remote project directory. See [Snapshot and backup management]({{ site.baseurl }}/cloud/project/project-webint-snap.html#db-dump).