Transfer data to and from a Dedicated Gen 2 cluster
Back to home
On this page
Transferring data to and from a Dedicated Gen 2 cluster slightly differs from the process on the Grid.
Back up your files
Platform.sh automatically creates backups of the Staging and Production environments of a Dedicated Gen 2 cluster every six hours. These are only useful to fully restore an environment and are managed by the support team.
You can make a manual local backup yourself by downloading data from your environment to your local system by running the following command:
platform scp -r remote:DIRECTORY_TO_SYNCHRONIZE LOCAL_DIRECTORY
This command copies all files from the DIRECTORY_TO_SYNCHRONIZE
in the environment you want to back up
to your LOCAL_DIRECTORY
.
Before running the command, make sure that you don’t overwrite local data (or do a backup first).
Back up your database
To back up your database, adapt and run the following command on your local computer:
platform db:dump --gzip
For more backup options and examples, see how to export data from an SQL database.
Synchronize files from Development to Staging/Production
To transfer data into either the Staging or Production environment, download data from your Development environment to your local system and from there to your Production/Staging environment.
Note
Be aware that synchronizing files is a destructive operation that overwrites data. Back up your Staging/Production files first.
-
To download data from your Development environment to your local system, adapt the following command:
platform scp --environment DEVELOPMENT_ENVIRONMENT -r remote:DIRECTORY_TO_SYNCHRONIZE LOCAL_DIRECTORY
-
To copy the local directory to the remote Staging/Production mount, adapt the following command:
platform scp --environment TARGET_ENVIRONMENT -r LOCAL_DIRECTORY remote:DIRECTORY_TO_SYNCHRONIZE
Synchronize a database from Development to Staging/Production
To synchronize a database into either the Staging or Production environment, export the database from your Development environment to your local system and from there to your Staging/Production environment.
Note
Be aware that this is a destructive operation that overwrites data. Back up your Staging/Production database first.
To synchronize your database:
-
Export the Development database to your local computer:
platform db:dump --environment DEVELOPMENT_ENVIRONMENT --file=dump.sql
For more backup options and examples, see how to export data from an SQL database.
-
Import the Development database dump file into the remote Staging/Production database:
platform sql --environment TARGET_ENVIRONMENT < dump.sql
What’s next?
For more granular connection options, see SSH connection details.