Magento 2 – unlock reindex process
In this tutorial I show you how to unlock reindex process. You may know the following error message from reindexer: “index is locked by another reindex process“. Sometimes this happens and there is no obvious way to fix this problem.
Magento 2 – unlock reindex process
Just imagine the following scenario. You shop does not display current information, a reindex is required. Magento 2 has no option for reindex from adminhtml, so you login trough SSH and run
1 | php bin/magento indexer:reindex |
but you discover some strange things. Some of your indexes are nor reindexing. They are skipped. Error message says, that index is locked by another reindex process. That is a problem, because there is no other indexer running and if you wait, these indexes does not get indexed. More aboud Magento 2 reindex.
In adminhtml this looks as follows:
Unlock index
It is easy to unlock an index. You just need to run the following command:
1 | php bin/magento indexer:reset |
It is possible to reset all indexer or a specific one. With it, each indexer gets invalidated. You are now able to run full index and each of you indexes gets reindexed without a problem.
You may now check your adminhtml index management page. It displays the following table:
Conclusion
If your indexer is locked by another process, don’t panic, there is a simple way to invalidate your indexes and run a full reindex again. In this tutorial I showed you all you need know about it. In Magento 2 it is a bit tricky with index process. It is different to Magento 1 and you may discover problems that information on store is not the same as in database. It is a good solution to “update on save” instead of “update by schedule”.
What is your opinion about Magento 2 indexer? What indexer mode do you prefer?
In your first line of code it’s actually “indexer:reindex” not “reindexer:reindex”.. just thought you might want to change that.
Thanks! I changed that.