This article contains industry-standard software terms that some may find racist, sexist, or oppressive and which may make the reader feel hurt, traumatized, or unwelcome. Adobe is working to remove these terms from our code, documentation, and user experiences.
For Adobe Commerce sites deployed on cloud infrastructure Pro architecture, Adobe recommends enabling the MYSQL slave connection for the database by default.
Adobe Commerce can read multiple databases asynchronously. When you enable the MYSQL slave connection, Adobe Commerce uses a read-only connection to the database to receive read-only traffic on a non-master node. The performance improves through load balancing when only one node handles read-write traffic.
Adobe Commerce on cloud infrastructure, Pro architecture
In the Adobe Commerce on cloud infrastructure, you can override the default configuration for the MYSQL slave connection by setting the MYSQL_USE_SLAVE_CONNECTION variable. Set this variable to true to automatically use a read-only connection to the database.
To enable the MySQL slave connection:
On your local workstation, change to your project directory.
.magento.env.yaml file, set the
MYSQL_USE_SLAVE_CONNECTION to true.
stage: deploy: MYSQL_USE_SLAVE_CONNECTION: true
.magento.env.yaml file changes and push to the remote environment.
After the deployment completes successfully, the MySQL slave connection is enabled for the cloud environment.
Learn more about customizing the cloud environment by overriding your existing Commerce configuration with Environment variables in the Adobe Commerce on cloud infrastructure guide.