We have consolidated our instructions for configuring Klevu data synchronisation with Magento 2. Please click here for the most up to date instructions: Magento 2 Data Sync Overview
From version 2.1.19 sync process can be done per store view.
1. Store wise data sync using command line
- Without signing in into Magento Admin Panel, please execute below command to get list of all store codes of website.
<path to php binary> <magento install dir>/bin/magento klevu:syncstore:storecode list
- Please execute below command to sync data using the store codes obtained.
<path to php binary> <magento install dir>/bin/magento klevu:syncstore:storecode "Comma separated store views code"
Only store codes that are part of one website can be run in a single process. Please set up commands for each website using the list that is returned from klevu:syncstore:storecode list Example :
Website1 : php bin/magento klevu:syncstore:storecode default,french
Website2 : php bin/magento klevu:syncstore:storecode german
Note : If you get any error during sync and you want to run command again then you need to clear lock file (example: klevu_search_english.lock ) from <magento install dir>/var directory.
2. Store wise data sync using external cron
In the case of larger product catalogs with many stores, from lots of processes relying on Magento cron, sometimes klevu cron keeps on running all the time or will be in a queue because of other module crons.
To avoid this, as an alternative, one can set up an external shell script for store wise data sync that runs independently of Magento cron. Follow the steps below to set up an external script for store wise data sync in Magento 2:
1. Login into Magento Admin Panel.
2. Please setup the below command to execute as an independent CRON Job every 30 minutes.
php bin/magento klevu:syncstore:storecode default
php bin/magento klevu:syncstore:storecode german
and So on..
Note: Here, default, german are the store codes and you need to change it as per the store codes defined at Magento level. Further, Please note, when the product sync is running, Klevu Magento 2 plugin creates a temporary lock file inside <magento-root-folder>/var folder to avoid executing multiple copies of Klevu’s product sync at the same time. Please make sure that the folder has enough permission to create the file.
4. Go to Stores → Configuration. Open Search Configuration under Klevu
5. Select option Never for Frequency under Data sync settings (the option is visible at default config level)
6. Click on Save Config.