|
| 1 | +--- |
| 2 | +group: configuration-guide |
| 3 | +title: Revert from a split database to a single database |
| 4 | +ee_only: true |
| 5 | +functional_areas: |
| 6 | + - Configuration |
| 7 | + - System |
| 8 | + - Setup |
| 9 | +--- |
| 10 | + |
| 11 | +The [split database]({{ page.baseurl }}/config-guide/multi-master/multi-master.html) feature was deprecated in version 2.4.2 of {{ site.data.var.ee }}. Follow these instructions to revert from a split database to a single database implementation. |
| 12 | + |
| 13 | +## Revert a split database implementation |
| 14 | + |
| 15 | +Reverting from a split database to a single database implementation involves creating backups of the `magento_quote` and `magento_sales` databases before loading them into the single `magento_main` database. |
| 16 | + |
| 17 | +In this example, we log in to all three databases, which are installed on the same host (`magento2-mysql`) as the "root" user. You must replace these values with the appropriate values for your databases. |
| 18 | + |
| 19 | +1. Create a backup of the `magento_quote` database: |
| 20 | + |
| 21 | + ```bash |
| 22 | + mysqldump -h "magento2-mysql" -u root -p magento_quote > ./quote.sql |
| 23 | + ``` |
| 24 | + |
| 25 | +1. Create a backup of the `magento_sales` database: |
| 26 | + |
| 27 | + ```bash |
| 28 | + mysqldump -h "magento2-mysql" -u root -p magento_sales > ./sales.sql |
| 29 | + ``` |
| 30 | + |
| 31 | +1. Load the `magento_quote` database into the `magento_main` database: |
| 32 | + |
| 33 | + ```bash |
| 34 | + mysql -h "magento2-mysql" -u root -p magento_main < ./quote.sql |
| 35 | + ``` |
| 36 | + |
| 37 | +1. Load the `magento_sales` database into the `magento_main` database: |
| 38 | + |
| 39 | + ```bash |
| 40 | + mysql -h "magento2-mysql" -u root -p magento_main < ./sales.sql |
| 41 | + ``` |
| 42 | + |
| 43 | +1. Drop the `magento_sales` database: |
| 44 | + |
| 45 | + ```bash |
| 46 | + mysql -h "magento2-mysql" -u root -p -e "DROP DATABASE magento_sales;" |
| 47 | + ``` |
| 48 | + |
| 49 | +1. Drop the `magento_quote` database: |
| 50 | + |
| 51 | + ```bash |
| 52 | + mysql -h "magento2-mysql" -u root -p -e "DROP DATABASE magento_quote;" |
| 53 | + ``` |
| 54 | + |
| 55 | +1. Remove the deployment configuration for `checkout` and `sales` in the `connections` and `resources` sections of the `env.php` file. |
| 56 | +1. Restore foreign keys: |
| 57 | + |
| 58 | + ```bash |
| 59 | + bin/magento setup:upgrade |
| 60 | + ``` |
| 61 | + |
| 62 | +## Verify your work |
| 63 | + |
| 64 | +To verify that your single database implementation is working properly, perform the following tasks and verify that data is added to the `magento_main` database tables using a database tool like [phpMyAdmin]({{ page.baseurl }}/install-gde/prereq/optional.html#install-optional-phpmyadmin): |
| 65 | + |
| 66 | +1. Verify that foreign keys have been restored. For example, the `QUOTE_STORE_ID_STORE_STORE_ID` key in the `quote` database table. |
| 67 | +1. Verify that customers can place orders from the storefront. |
| 68 | +1. Verify that orders created before reverting the split database to a single database are available in the Admin. |
0 commit comments