Magento Expert Forum - Improve your Magento experience

Results 1 to 14 of 14

Re-indexing Magento through the command line

  1. #1
    Junior Member golddev's Avatar
    Join Date
    Mar 2013
    Posts
    41
    Thanks
    1
    Thanked 9 Times in 5 Posts

    Thumbs up Re-indexing Magento through the command line

    From time to time, you might find the need to re-index Magento via the command line. This could be for a whole host of reasons, for example, if the indexer is timing out or not finishing through the web interface.

    Magento includes an indexing script and you can find it in the shell folder.

    From here, you have a number of commands at your disposal.

    Checking for the status of all indexes



    Code:
    php indexer.php --status
    Should give you output like this:

    Code:
    Product Attributes:            Pending
    Product Prices:                Pending
    Stock Status:                  Pending
    Tag Aggregation Data:          Pending
    Default Values:                Pending
    Catalog URL Rewrites:          Pending
    Product Flat Data:             Require Reindex
    Category Flat Data:            Pending
    Category Products:             Pending
    Catalog Search Index:          Pending

    Re-indexing a single index



    Each index has its own index key that you can use to reference it when asking Magento to re-index. To get these keys, you can use the following command:

    Code:
    php indexer.php --info
    Giving you:

    Code:
    catalog_product_attribute     Product Attributes
    catalog_product_price         Product Prices
    tag_summary                   Tag Aggregation Data
    mana_db_replicator            Default Values
    catalog_url                   Catalog URL Rewrites
    catalog_product_flat          Product Flat Data
    catalog_category_flat         Category Flat Data
    catalog_category_product      Category Products
    catalogsearch_fulltext        Catalog Search Index

    To reindex a single index, run the following command.

    Code:
    php indexer.php --reindex [Index Option Code]
    This can be comma delimited for multiple indices:

    Code:
    php indexer.php --reindex catalog_product_price,catalog_url,catalog_product_flat

    Re-index all indices



    The following code will loop through each index and re-index it.

    Code:
    php indexer.php --reindexall

    View more threads in the same category:


  2. The Following User Says Thank You to golddev For This Useful Post:

    hedkey (05-03-2018)

  3. #2
    New member
    Join Date
    Jul 2015
    Location
    Punjab
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Here are step by step instructions to ReIndex Magento indexers via SSH :

    Firstly, we have to check whether SSH is enabled on our server or not. If it is not enabled, ask your hosting to enable it or you can enable it from WHM.

    1 - After logging in to SSH, type cd public_html ( if magento installation is in public_html ) & hit enter

    2 - Then we have to move in shell directory, for that type cs shell

    3 - To execute re-index process use the command below:

    php -f indexer.php reindexall

    4 - We can do Reindexing for each Reindexer Indvidually, for that type below commands one by one

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

  4. #3
    Junior Member
    Join Date
    Feb 2016
    Posts
    42
    Thanks
    1
    Thanked 2 Times in 2 Posts

    Default

    Thanks for share the good answer.

  5. The Following User Says Thank You to Mariajerek For This Useful Post:

    hedkey (05-03-2018)

  6. #4
    Expert
    Join Date
    Mar 2016
    Location
    india
    Posts
    570
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Hi,
    Magento uses a lot of resources to re-index data from the Admin Panel. A good way to re-index data without using the admin panel is to use command shell “ssh”. This also would work if you happen to be locked out of the admin panel.

    Here is instruction on how to use default Magento indexer via SSH:

    1 – Go to ‘shell’ folder in your Magento installation:

    *cd shell

    2 – Execute reindex using this command:

    *php -f indexer.php reindexall

    It is possible to get full list of Magento indexer commands using this command:

    *php -f indexer.php help

    To get a list of available indexes, execute this command:

    *php -f indexer.php info

    By default there are 8 indexes in Magento:

    *catalog_product_attribute Product Attributes
    *catalog_product_price Product Prices
    *catalog_url Catalog Url Rewrites
    *catalog_product_flat Product Flat Data
    *catalog_category_flat Category Flat Data
    *catalog_category_product Category Products
    *catalogsearch_fulltext Catalog Search Index
    *cataloginventory_stock Stock status

    Individual commands for re-indexing:

    *php indexer.php --reindex catalog_product_attribute
    *php indexer.php --reindex catalog_product_price
    *php indexer.php --reindex catalog_url
    *php indexer.php --reindex catalog_product_flat
    *php indexer.php --reindex catalog_category_flat
    *php indexer.php --reindex catalog_category_product
    *php indexer.php --reindex catalogsearch_fulltext
    *php indexer.php --reindex cataloginventory_stock
    *php indexer.php --reindex tag_summary

  7. The Following User Says Thank You to sudhakar For This Useful Post:

    hedkey (05-03-2018)

  8. #5
    Junior Member clapcreative's Avatar
    Join Date
    Jul 2015
    Location
    149 Mcafee court , Thousand Oaks CA 91360
    Posts
    115
    Thanks
    3
    Thanked 6 Times in 6 Posts

    Default

    Here is another effective method of Re-indexing Magento Through Command line: -

    Command to check the current status of all indices is:

    php /your-magento-path/shell/indexer.php --status
    php /your-magento-path/shell/indexer.php info
    To refresh the specific index, you need to select a specific indices to index. This will return results like followings:


    catalog_product_attribute Product Attributes
    catalog_product_price Product Prices
    catalog_url Catalog Url Rewrites
    catalog_product_flat Product Flat Data
    catalog_category_flat Category Flat Data
    catalog_category_product Category Products
    catalogsearch_fulltext Catalog Search Index
    cataloginventory_stock Stock status
    Now, to run indexer on any indices you have to run command like this

    php /your-magento-path//shell/indexer.php --reindex catalog_product_price
    OR
    php /your-magento-path//shell/indexer.php --reindex cataloginventory_stock
    The command line approach is considered to be little bit faster than admin panel.


    Vote if Helpful.

  9. #6
    Junior Member
    Join Date
    Jan 2016
    Location
    Rajkot, Gujarat, India
    Posts
    20
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Hi,

    In my case I am trying to re-index magento via command line at that time get an error message, and error message not approved at that time re-index process broken.

    and later i realize that this problem appearing due to lots of product in my database and limited service resources I have.

    Thanks for the code.

  10. #7
    Junior Member
    Join Date
    Feb 2017
    Posts
    19
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Your article is awesome! How long does it take to complete this article? I have read through other blogs, but they are cumbersome and confusing. I hope you continue to have such quality articles to share with everyone! I believe there will be many people who share my views when they read this article from you!
    vex 3

  11. #8
    Junior Member
    Join Date
    Feb 2017
    Posts
    19
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Your article is awesome! How long does it take to complete this article? I have read through other blogs, but they are cumbersome and confusing. I hope you continue to have such quality articles to share with everyone! I believe there will be many people who share my views when they read this article from you!
    happy wheels

  12. #9
    Junior Member
    Join Date
    Feb 2017
    Posts
    19
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Thanks for your post! Through your pen I found the problem up interesting! I believe there are many other people who are interested in them just like me! How long does it take to complete this article? I have read through other blogs, but they are cumbersome and confusing. I hope you continue to have such quality articles to share with everyone!
    io games

  13. #10
    Junior Member
    Join Date
    Feb 2018
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    hello to everyone

    i can't understand this topic anyone idea about indexing magneto through command line let me explain

    ISO 9001 Certification in Philippines

  14. #11
    New member
    Join Date
    Mar 2018
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    I’m satisfied that you simply shared this helpful info with us. Please keep us up to date like this. Thanks for sharing.
    * gmail sign up

  15. #12
    New member
    Join Date
    Aug 2018
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I was a girl, but clumsy things. I do not know how to cook, sew, above, ca. I have too insipid and tedious, but that's my personality. It's hard to change
    entrar no hotmail

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •