[PaaS only]{class="badge informative" title="Applies to Adobe Commerce on Cloud projects (Adobe-managed PaaS infrastructure) and on-premises projects only."}

Create database dump on Adobe Commerce on cloud infrastructure

This article discusses the possible (and recommended) ways to create a database (DB) dump on Adobe Commerce on cloud infrastructure.

You only need to use one variant (option) to dump your DB. These options apply to any environment type (Integration, Staging, Production) and any plan (Adobe Commerce on cloud infrastructure Starter plan architecture and Adobe Commerce on cloud infrastructure Pro plan architecture).

Prerequisite: SSH to your environment

To dump your DB on Adobe Commerce on cloud infrastructure with any variant discussed in this article, you must first SSH to your environment.

WARNING
Whether you choose Option 1 or Option 2 please run the command during off peak hours against a database secondary node.

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

vendor/bin/ece-tools db-dump

This is the recommended and safest option.

See Dump your database (ECE-Tools) in our Commerce on Cloud Infrastructure Guide.

Option 2: mariadb-dump (or mysqldump for older versions)

For newer MariaDB versions (11.x and later)

Starting from MariaDB 11.0.1, the mysqldump symlink is deprecated. You are recommended to use mariadb-dump instead.

For more information, refer to mariadb-dump client utility.

For older MariaDB versions

If you are on an older MariaDB version where mariadb-dump is not available, you may dump your DB using the native MySQL mysqldump command.

note warning
WARNING
Do not run this command against the database cluster. The cluster will not differentiate whether it is run against the database primary or against a secondary. If the cluster runs this command against the primary, the database will be unable to execute writes until the dump is completed and could impact performance and site stability.

The entire command might look as follows:

code language-sql
mysqldump -h <host> -u <username> -p <password> --single-transaction <db_name> | gzip > /tmp/<dump_name>.sql.gz

The database backup created by running the mysqldump command and saved in \tmp, should be moved from this location. It should not take up storage space in \tmp (which might result in problems).

To obtain your DB credentials (host, username, and password), you might call the MAGENTO_CLOUD_RELATIONSHIPS environment variable:

echo $MAGENTO_CLOUD_RELATIONSHIPS |base64 --d |json_pp

Related documentation:

recommendation-more-help
8bd06ef0-b3d5-4137-b74e-d7b00485808a