How To Rebuild Magento Indexes Using PuTTY SSH Commands
Magento Open-Source E-Commerce Community Edition: 2.30
This post will guide you to rebuild indexes (reindex) using Putty SSH. You’ll need to download PuTTY, a free SSH and telnet client, to run your SSH commands for reindexing.
You’ll also need to logon to Root WHM and under Plugins click on Add IP to Firewall. Find your IP address, copy it and enter it in the Allow Rule field. Then make sure to restart the firewall for the changes to take effect.
Index Management
Go to Magento Admin > System > Index Management, this screen will show you the date and time the indexes were last updated. The Update on Save mode will update the index when an update on a record triggers an action to reindex. Where the Update by Schedule mode updates all the indexes on a regular basis, except for the Customer Grid which only supports the on save mode.
Sometimes you’ll see a yellow warning message appear that reads “One or more indexes are invalid. Make sure your Magento cron job is running.”
PuTTY SSH Commands
Run PuTTY > Enter Host Name (or IP address) > click Open > login as: (magento file system owner) > enter password > change directory to the (magento root directory) by using cd command (i.e. cd /home/(magento file system owner)/public_html).
Run the below commands by copying and pasting a row at a time and then pressing enter on PuTTY if the command did not already process.
php bin/magento indexer:reindex customer_grid;
php bin/magento indexer:reindex design_config_grid;
php bin/magento indexer:reindex catalog_category_product;
php bin/magento indexer:reindex catalog_product_category;
(go to system > cache management > flush magento cache)
php bin/magento indexer:reindex catalog_product_attribute;
php bin/magento indexer:reindex cataloginventory_stock;
php bin/magento indexer:reindex inventory;
php bin/magento indexer:reindex catalogrule_product;
php bin/magento indexer:reindex amasty_pgrid_qty_sold;
php bin/magento indexer:reindex amasty_ogrid_attribute_index;
For more commands when it comes to Magento Index Management please see our post…
Also make sure to view the Magento Index Management User Guide for best practices.