Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to stop a magento indexer process?

Tags:

magento

I've searched similar topics but no solution seems to work. Is there a way to stop a specific magento indexer process?

When I try to reindex from shell I get this:

php -f indexer.php reindex all
Stock Status Index process is working now. Please try run this process later.
Product Prices Index process is working now. Please try run this process later.
Catalog URL Rewrites Index process is working now. Please try run this process later.
Product Flat Data Index process is working now. Please try run this process later.
Category Flat Data Index process is working now. Please try run this process later.
Category Products Index process is working now. Please try run this process later.
Catalog Search Index Index process is working now. Please try run this process later.
Stock Status index was rebuilt successfully
Tag Aggregation Data Index process is working now. Please try run this process later.

When I try to see indexer status I get this:

Product Attributes:            Pending
Product Prices:                Pending
Catalog URL Rewrites:          Pending
Product Flat Data:             Pending
Category Flat Data:            Pending
Category Products:             Pending
Catalog Search Index:          Pending
Stock Status:                  Pending
Tag Aggregation Data:          Pending

If I reindex from the admin, reindexing process throws no errors. Is there a link to some documentation on this matter?

Thanks, Radu

like image 625
Radu Avatar asked Mar 29 '12 11:03

Radu


2 Answers

Indexing mostly (mostly meaning I'm pretty sure it's always) happens during a single HTTP request. If that request stop/timeouts/fails because of a PHP error, the indexer leaves lock files lying around even though there's no indexing going on. These files are located in

/path/to/mage/var/locks/index_process*.lock

The

Index process is working now. Please try run this process later

exception is Magento telling you it sees one of these lock files. If you know for sure no one else is trying to run an index, just delete the files and restart your indexing.

like image 200
Alan Storm Avatar answered Oct 29 '22 07:10

Alan Storm


First, try to set the index mode to manual:

php indexer.php --mode-manual catalog_product_attribute
php indexer.php --mode-manual catalog_product_price
php indexer.php --mode-manual catalog_url
php indexer.php --mode-manual catalog_product_flat
php indexer.php --mode-manual catalog_category_flat
php indexer.php --mode-manual catalog_category_product
php indexer.php --mode-manual catalogsearch_fulltext
php indexer.php --mode-manual cataloginventory_stock
php indexer.php --mode-manual tag_summary

Then, try to reindex all indexes:

php indexer.php reindexall

And set the mode to realtime again:

php indexer.php --mode-realtime catalog_product_attribute
php indexer.php --mode-realtime catalog_product_price
php indexer.php --mode-realtime catalog_url
php indexer.php --mode-realtime catalog_product_flat
php indexer.php --mode-realtime catalog_category_flat
php indexer.php --mode-realtime catalog_category_product
php indexer.php --mode-realtime catalogsearch_fulltext
php indexer.php --mode-realtime cataloginventory_stock
php indexer.php --mode-realtime tag_summary

If this does not work, try to restart apache with something like sudo /etc/init.d/apache2 restart. This should stop the indexing process and you can probably start it again afterwards. But mind that your site will not be available for a few seconds if you restart Apache.

like image 42
Simon Avatar answered Oct 29 '22 07:10

Simon