ReadyMage Help
  • ReadyMage
  • USER PORTAL
    • User Portal Access
    • Change Password
    • Two-Factor Authentication
  • Project Management
    • Project List
    • Project Settings
      • General Info
      • Git Management
      • Environments
      • Members and roles
      • Security
        • Deletion Protection
        • TFA Enforcement
      • Delete Project
  • Application Management
    • Magento Details
    • Domain Management
    • Logs & Monitoring
    • Backups
      • Backup process
      • Disaster recovery process
    • Deployments
      • Deploy without build cache
      • Queue Tab (Launching soon)
      • Settings Tab (Launching soon)
        • Automatic Deployments
        • ReadyMage Maintenance Page
          • Website Access During Maintenance
      • Notifications Tab (Launching soon)
        • Managing email notifications
        • Managing Slack notifications
      • Pipeline Deployments
      • Pipeline Configuration file
        • Migration guide from 0.x.x to 1.0.0
    • SSH Access
      • SSH Usage
      • Database Access using Graphical Interface
      • Troubleshooting
    • IP Whitelist
    • Password Authentication
    • Database & Media
    • Search Engine Bots Discovery
  • Service Management
    • Server-Side Rendering
    • SFTP
    • NewRelic
    • Packagist Modules
    • Cloudflare
  • Infrastructure Management
    • Autoscale
    • Sleep Mode
    • Manage Services
    • Historical Resource Usage
  • PROJECT DEVELOPMENT
    • Node.js version
    • Store access
    • Creating a Production Environment
    • Additional Environments
    • ScandiPWA, PWA Studio, Hyva, or Luma
    • Project Migration to ReadyMage
    • SSH Access for Magento CLI, database and media
    • Code customization and local setup
    • Extension installation
    • Add translations (switch locale)
    • Existing ScandiPWA Project Code Migration
    • Database and media migration
    • Redirect setup
    • Connect CDN and WebP optimization
    • Email setup
    • Changing the Domain & Multi-Store Set up
    • Internal service addresses
    • Kibana filters and useful CLI commands
    • Persistent directories
  • FAQ
    • General
    • Autoscaling
    • Billing
    • User Portal Options
    • Services connected to ReadyMage
    • Hosting, managing resources and autoscaling
    • Source Code Management
    • ScandiPWA and Magento Versions, Commerce Edition and Upgrades
    • Supported software versions
Powered by GitBook
On this page
  • Migrate ReadyMage database to your local setup
  • Know Issues
  • Migrate local database to ReadyMage
  • Known Issues
  • Migrate ReadyMage media to your local setup
  • Migrate local media to ReadyMage

Was this helpful?

  1. PROJECT DEVELOPMENT

Database and media migration

PreviousExisting ScandiPWA Project Code MigrationNextRedirect setup

Last updated 1 month ago

Was this helpful?

Migrate ReadyMage database to your local setup

  1. Setup SSH access following these .

  2. Connect to SSH through your terminal.

  3. Run the following commands to create a database dump zip file on the ReadyMage server: mysqldump magento --single-transaction --no-tablespaces | zip dump.sql.gz -

  4. Exit SSH by running command exit

  5. Navigate to the directory where you want to download the database dump on your local machine, for example, Desktop: cd desktop

  6. Run commands scp {SSH USER}:/home/magento/dump.sql.gz . Make sure to replace {SSH USER} part with your ReadyMage SSH username, for example,

    scp store-pwruv-shj-1611224333-user@prod.ssh.us.i.readymage.com:/home/magento/dump.sql.gz .

  7. Unarchive the dump locally.

  8. Rename the unarchived file to dump.sql

  9. Make sure that your local Magento application is running and run the following command to import database dump (./dump.sql should be replaced with the path your dump file) npm run import-db ./dump.sql If the import-db command doesn't exist, check known issues below.

  10. Navigate to your project repository using terminal and run the following commands: npm run stop npm run start npm run cli magento indexer:reindex magento cache:clean

  11. Create a new admin user to be used on your local setup by running this command magento admin:user:create

Know Issues

Import-db not available

If the import-db command is not available add the following line to the package.json file located in the root folder of the cloned repository:

"import-db": "magento-scripts import-db"

Your package.json file scripts variable should have the import-db add

"scripts": {
        "import-db": "magento-scripts import-db",
        "start": "magento-scripts start",
        "stop": "magento-scripts stop",
        "cli": "magento-scripts cli",
        "logs": "magento-scripts logs",
        "link": "magento-scripts link",
        "status": "magento-scripts status",
        "exec": "magento-scripts exec"
    },

Migrate local database to ReadyMage

  1. Navigate to your project repository using terminal and run the following command: npm run status

  2. Copy the name of the MySQL container, for example, readymage-mystore-pwruv-shj-1611224333-master_mysql

  3. Create database dump by running the following command: docker exec {MYSQL CONTAINER NAME} mysqldump magento --single-transaction --no-tablespaces -u magento -pmagento --result-file=/tmp/dump.sql

    Replace {MYSQL CONTAINER NAME} by the container name you copied in step 2.

  4. Download the dump to your Desktop by running the following command: docker cp {MYSQL CONTAINER NAME}:/tmp/dump.sql ~/Desktop/dump.sql

  5. Before importing the database dump to your ReadyMage instance open the database dump and change all the mentions of utf8mb4_general_ci to utf8mb4_0900_ai_ci

  6. Move your database to the ReadyMage server by running the following command from your terminal: scp {LOCAL PATH TO YOUR DUMP} {SSH USER}:/home/magento/dump.sql Replace {LOCAL PATH TO YOUR DUMP} with the path to your database dump and {SSH USER} with your SSH username, for example,

    scp ~/Desktop/dump.sql store-pwruv-shj-1611224333-user@prod.ssh.us.i.readymage.com:/home/magento/dump.sql

  7. Drop the database DROP DATABASE magento; CREATE DATABASE magento;

  8. Connect to SSH and run the following command: mysql magento < dump.sql

  9. Connect to mysql by running mysql command in terminal.

  10. Run the following commands (replace {STORE URL} with your instance store URL): use magento

    — Set the search engine to Elasticsearch UPDATE core_config_data SET value = "elasticsearch" WHERE path = "catalog/search/elasticsearch7_server_hostname";

    — If OpenSearch is used instead, set the search engine accordingly UPDATE core_config_data SET value = "opensearch" WHERE path = "catalog/search/opensearch_server_hostname";

  11. UPDATE core_config_data SET value="9200" where path="catalog/search/elasticsearch7_server_port"; or UPDATE core_config_data SET value="9200" where path="catalog/search/opensearch_server_port";

    UPDATE core_config_data SET value="2" where path="system/full_page_cache/caching_application";

    UPDATE core_config_data SET value="http://{STORE URL}/" where path="web/unsecure/base_url";

    UPDATE core_config_data SET value="https://{STORE URL}/" where path="web/secure/base_url";

    UPDATE core_config_data SET value="1" where path="web/secure/use_in_frontend";

    UPDATE core_config_data SET value="1" where path="web/secure/use_in_adminhtml"; UPDATE core_config_data SET value="{STORE URL}" where path="web/cookie/cookie_domain";

    exit

  12. Access SSH and run the following commands: magento indexer:reindex magento cache:clean

Known Issues

  • Error: ERROR 1227 (42000) at line XX: Access denied; you need (at least one of) the SUPER or SET_USER_ID privilege(s) for this operation Please check the reported line. If DEFINER is specified, please remove it.

    To remove it from the entire SQL dump file (DATA-DUMP.sql), you can use the following sed command: sed 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' DATA-DUMP.sql > DATA-DUMP--cleared.sql

Migrate ReadyMage media to your local setup

  1. Run command to download Media Content to your desktop (change the ~/Desktop/media path to your path where you want to dump the media): rsync -azh --partial --append {SSH USER}:/home/magento/media/ ~/media Replace {SSH USER} with your SSH username, for example, rsync -azP store-pwruv-shj-1611224333-user@ssh.ireland.eu.i.readymage.com:/home/magento/media/ ./Desktop/

  2. Move downloaded media content to your repository pub/media folder.

  3. Navigate to the repository in the terminal and run the following commands: npm run cli magento indexer:reindex magento cache:clean

Migrate local media to ReadyMage

  1. Navigate to your repository pub folder in terminal and run the command: rsync -azP media/ {SSH USER}:/home/magento/media/

    Replace {SSH USER} with your SSH username, for example, rsync -azh --partial --append --chmod=Du=rwx,Dg=rwx,Do=rx,Fu=rw,Fg=rw,Fo=r media/ store-pwruv-shj-1611224333-user@ssh.ireland.eu.i.readymage.com:/home/magento/media/

  2. Connect to SSH and run the following commands: magento indexer:reindex magento cache:clean

  3. Restart Varnish from Infrastructure Management > Manage Services.

Setup SSH access following these . You don't have to connect to it.

Error: Catalog Search index exception: Could not ping search engine: No alive nodes found in your cluster Update search engine port to 9200 in your instance database core config table. Follow instructions .

Setup SSH access following these .

Setup SSH access following these .

instructions
instructions
here
instructions
instructions