Database and media migration
Migrate ReadyMage database to your local setup
Setup SSH access following these instructions.
Connect to SSH through your terminal.
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 -Exit SSH by running command
exitNavigate to the directory where you want to download the database dump on your local machine, for example, Desktop:
cd desktopRun commands
scp {SSH USER}:/home/magento/dump.sql.gz .Make sure to replace {SSH USER} part with your ReadyMage SSH username, for example,scp [email protected]:/home/magento/dump.sql.gz .Unarchive the dump locally.
Rename the unarchived file to
dump.sqlMake 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.sqlIf the import-db command doesn't exist, check known issues below.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:cleanCreate 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:
Your package.json file scripts variable should have the import-db add
Migrate local database to ReadyMage
Navigate to your project repository using terminal and run the following command:
npm run statusCopy the name of the MySQL container, for example,
readymage-mystore-pwruv-shj-1611224333-master_mysqlCreate 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.sqlReplace {MYSQL CONTAINER NAME} by the container name you copied in step 2.
Download the dump to your Desktop by running the following command:
docker cp {MYSQL CONTAINER NAME}:/tmp/dump.sql ~/Desktop/dump.sqlBefore importing the database dump to your ReadyMage instance open the database dump and change all the mentions of
utf8mb4_general_citoutf8mb4_0900_ai_ciSetup SSH access following these instructions. You don't have to connect to it.
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.sqlReplace{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 [email protected]:/home/magento/dump.sqlDrop the database
DROP DATABASE magento; CREATE DATABASE magento;Connect to SSH and run the following command:
mysql magento < dump.sqlConnect to mysql by running
mysqlcommand in terminal.Run the following commands (replace {STORE URL} with your instance store URL):
use magentoUPDATE core_config_data SET value="elasticsearch" where path="catalog/search/elasticsearch7_server_hostname";UPDATE core_config_data SET value="9200" where path="catalog/search/elasticsearch7_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";exitAccess SSH and run the following commands:
magento indexer:reindex magento cache:clean
Known Issues
Error: Catalog Search index exception: Could not ping search engine: No alive nodes found in your cluster Update elasticsearch port to 9200 in your instance database core config table. Follow instructions here.
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
DEFINERis specified, please remove it.To remove it from the entire SQL dump file (
DATA-DUMP.sql), you can use the followingsedcommand:sed 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' DATA-DUMP.sql > DATA-DUMP--cleared.sql
Migrate ReadyMage media to your local setup
Setup SSH access following these instructions.
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/ ~/mediaReplace{SSH USER}with your SSH username, for example,rsync -azP [email protected]:/home/magento/media/ ./Desktop/Move downloaded media content to your repository
pub/mediafolder.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
Setup SSH access following these instructions.
Navigate to your repository
pubfolder 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/ [email protected]:/home/magento/media/Connect to SSH and run the following commands:
magento indexer:reindex magento cache:cleanRestart Varnish from
Infrastructure Management > Manage Services.
Last updated