0

We have a Magento2 shop with 20.000+ products and multiple storefronts.

So reindexing takes a long time (about 10 minutes).

We want the reindexing of catalog_category_product and catalog_product_category to only take place at night.

Like Magento recommends over here:

https://docs.magento.com/m2/ce/user_guide/system/index-management.html

But I don't know how to configure this. Does anyone have any idea?

2 Answers 2

2

As you mention you have so many products in your catalog, so i suggest to run the cron at midnight or you can select any other time as per your website's traffic timing.

Below is the cron command you need to set in server, first open your SSH ternimal and login in that, then type command crontab -e then copy below code and paste into the terminal window and save the crontab.

0 0 1 * 0-6 php /your_magento_root/bin/magento index:reindex catalog_category_product

The above cron code will execute at every day 12AM UTC timezone like below :

2020-02-29 00:00:00 UTC
2020-03-01 00:00:00 UTC
2020-03-02 00:00:00 UTC

If above code is working or useful for you then upvote the answer and mark the answer as accepted so that other users can easily identify the answer.

1

you can set it using crontab -e if you are using Linux or set cron jobs in windows.

0 0 * * * php /path/to/your/site/root/bin/magento index:reindex <index_type>
1
  • You can use crontab.guru for help on the expression.
    – Dacod
    Commented Feb 28, 2020 at 11:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.