Contents
Overview of master databases
This topic discusses how to get started with the split database solution by:
- Installing Magento 2 EE with a single master database (named
magento
) - Creating two additional master databases for checkout and OMS (named
magento_checkout
andmagento_oms
) - Configuring EE to use the checkout and OMS databases
This guide assumes all three databases are on the same host as the Magento application and that they're named magento
, magento_checkout
, and magento_oms
. However, the choice of where to locate the databases and what they're named is up to you. We hope our examples make the instructions easier to follow.
Install the Magento EE software
You can enable split databases at any time after you install the Magento EE software; in other words, you can add split databases to an EE system that already has checkout and order data. Use the instructions in the Magento 2 EE README or the installation guide to install the Magento 2 EE software using a single master database.
Set up additional master databases
Create checkout and OMS master databases as follows:
- Log in to your database server as any user.
-
Enter the following command to get to a MySQL command prompt:
mysql -u root -p
- Enter the MySQL
root
user鈥檚 password when prompted. -
Enter the following commands in the order shown to create database instances named
magento_checkout
andmagento_oms
with the same user names and passwords:create database magento_checkout; GRANT ALL ON magento_checkout.* TO magento_checkout@localhost IDENTIFIED BY 'magento_checkout'; create database magento_oms; GRANT ALL ON magento_oms.* TO magento_oms@localhost IDENTIFIED BY 'magento_oms';
-
Enter
exit
to quit the command prompt. -
Verify the databases, one at a time:
Checkout database:
mysql -u magento_checkout -p exit
Order management database:
mysql -u magento_oms -p exit
If the MySQL monitor displays, you created the database properly. If an error displays, repeat the preceding commands.
Configure Magento EE to use the master databases
After setting up a total of three master databases, use the Magento command line to configure Magento to use them. (The command sets up database connections and distributes tables among the master databases.)
First steps
-
Log in to the Magento server as, or switch to, a user who has permissions to write to the Magento file system. One way to do this is to switch to the Magento file system owner.
If you use the bash shell, you can also use the following syntax to switch to the Magento file system owner and enter the command at the same time:
su <Magento file system owner> -s /bin/bash -c <command>
-
To run Magento commands from any directory, add
<your Magento install dir>/bin
to your systemPATH
.Because shells have differing syntax, consult a reference like unix.stackexchange.com.
bash shell example for CentOS:
export PATH=$PATH:/var/www/html/magento2/bin
You can also run the commands in the following ways:
cd <your Magento install dir>/bin
and run them as./magento <command name>
php <your Magento install dir>/bin/magento <command name>
<your Magento install dir>
is a subdirectory of your web server's docroot. Need help locating the docroot? Click here.
Configure the checkout database
Command syntax:
magento setup:db-schema:split-quote --host="<checkout db host or ip>" --dbname="<name>" --username="<checkout db username>" --password="<password>"
For example,
magento setup:db-schema:split-quote --host="localhost" --dbname="magento_checkout" --username="magento_checkout" --password="magento_checkout"
The following message displays to confirm a successful setup:
Migration has been finished successfully!
Configure the OMS database
Command syntax:
magento setup:db-schema:split-sales --host="<checkout db host or ip>" --dbname="<name>" --username="<checkout db username>" --password="<password>"
For example,
magento setup:db-schema:split-sales --host="localhost" --dbname="magento_oms" --username="magento_oms" --password="magento_oms"
The following message displays to confirm a successful setup:
Migration has been finished successfully!
Find us on