0

I am new in magento commerce cloud. I need to setup the magento store in my local system. I have downloaded the files from the commerce git and it is working fine. But how can I access the database? I need to import the database to my local system. I have created the database backup using the below command.

vendor/bin/ece-tools db-dump

How can I download it in to my local system? Please help me

2

As MSA has noted, you can ssh into the machine and use ece-tools db-dump and then rsync the database dump down locally.Here is the rsync command

 rsync -avzh <SSH URL>:/tmp/<BACKUP NAME> ./

Another option is to utilize the magento-cloud CLI utility. You can download the CLI utility with these instructions: https://devdocs.magento.com/guides/v2.1/cloud/before/before-workspace-magento-prereqs.html#cloud-ssh-cli-cli-install

Once you have that installed you can create a dump like this: magento-cloud db:dump -p <PROJECT ID> -e <ENVIRONMENT NAME>

The `magento-cloud CLI will also allow you to open up an SSH tunnel to the database so you could access it locally.

  • I have created the dump. Now I need to download it into my local system. – Jancy Abraham Jun 25 at 7:50
  • 1
    You just need to rsync it local. Something like this should work: rsync -avzh <SSH URL>:/tmp/<BACKUP NAME> ./ – Billy Gilbert Jun 27 at 15:04
  • Yes, Now it is working. Thank you so much Billy Gilbert. Please update your answer. – Jancy Abraham Jun 28 at 3:29
0

db-dump (ece-tools; recommended)

You may dump your DB using the ECE-Tools command:

To update the ece-tools package:

On your local workstation, perform an update using Composer.

composer update magento/ece-tools

If you cannot update beyond ece-tools version 2002.0.8, follow the upgrade steps.

Add, commit, and push your code changes.

git add -A && git commit -m "Update magento/ece-tools" && git push origin <branch name>

After test validation, merge this branch to the Integration branch.

vendor/bin/ece-tools db-dump

This the recommended and the safest option.

Download Database

  1. We recommend putting the application in maintenance mode before doing a database dump in Production environments.
  2. The command creates an archive in your local project directory called dump-<timestamp>.sql.gz.
  3. If an error occurs during the dump, the command deletes the dump file to conserve disk space. Review the logs for details (/var/log/cloud.log).

For more details refer https://support.magento.com/hc/en-us/articles/360003254334-Create-database-dump-on-Cloud

  • I have created the backup using this command vendor/bin/ece-tools db-dump. It creates the backup in /tmp folder. How can I download it into my local workstation – Jancy Abraham Jun 25 at 3:16
  • Check updated answer @jancy – MSA Jun 25 at 6:47
  • Yes the command creates an archive dump-<timestamp>.sql.gz. in my /tmp directory. Not in my project directory – Jancy Abraham Jun 25 at 6:49
  • mysqldump -u {user} -p {database} | gzip > {database}.sql.gz – MSA Jun 25 at 6:51
  • Did you try this? – MSA Jun 25 at 6:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.