ÃÛ¶¹ÊÓÆµ

Environment redeployment failed or MySQL server gone away

This article provides a solution for ÃÛ¶¹ÊÓÆµ Commerce (all deployment methods) issues, where the outage of space allocated for MySQL causes stuck deployment or database connection errors.

Description description

Environment

ÃÛ¶¹ÊÓÆµ Commerce on-premises and ÃÛ¶¹ÊÓÆµ Commerce on cloud infrastructure (all versions)

Issue

  • Deploy process fails with the following error in the deploy log (command line and UI log):

    code language-none
    Re-deploying environment abcdefghijklm-master-7rqtwti
        E: Environment redeployment failed
    
  • ÃÛ¶¹ÊÓÆµ Commerce responds with 503 error, and the following error message is displayed in application logs:

    code language-none
    SQLSTATE[ HY000]  [ 2006]  MySQL server has gone away
    
  • And the following error appears when you connect to a MySQL server:

    code language-none
    ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0 "Internal error/check (Not system error)"
    

Cause

For all ÃÛ¶¹ÊÓÆµ Commerce on cloud infrastructure Starter plan architecture environments, and Integration environment of the ÃÛ¶¹ÊÓÆµ Commerce on cloud infrastructure Pro plan architecture, SSH to the environment and run the command:

magento-cloud db:size

For the Staging or Production environment of the Pro architecture, [ SSH to the environment] , and run the df -h | grep mysql command. The result will look similar to the following:

sxpe7gigd5ok2@i-00baa9e24f31dba41: $ df -h | grep mysql
/dev/xvdj                            40G  7.4G   32G  19% /data/mysql

Resolution resolution

To solve the issue, you need to allocate more space for MySQL

For all Starter architecture and Pro architecture Integration environments, this is done in the .magento/services.yaml file, by increasing the mysql: disk: parameter. For example:

mysql:
    type: mysql:10.0
    disk: 2048

See the Set up MySQL service article for reference.

To make these changes for the Staging or Production environment of the Pro architecture, you must create a . But typically, you will not have to deal with this on Staging/Production of the Pro architecture as ÃÛ¶¹ÊÓÆµ Commerce monitors these parameters for you and alerts you and/or takes actions according to the contract.

Applying the changes

Once you change the .magento/services.yaml file, you need to commit and push your changes for them to be applied. The push will trigger the deployment process.

recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f