how to exploit all commands in magento 2 CLI (Part 2)

Here the following steps help you how to exploit all commands in Magento 2 CLI (Part 2)

Part 2: organize indexers using CLI

Everyone knows Magento 2 has a powerful command-line interface tools (CLI). It permits you to complete task including installation, configuration, database backups, compiling LESS etc. Here I will show you  How to organize indexers using Magento 2 using CLI. Before starting this guide please,refer our previous guidelines to know about  Magento 2 CLI.

The following steps to organize indexers using CLI:

Step 1: Examine the list of indexers in Magento 2

php bin/magento indexer:info

You will get the following result

catalog_category_product                 Category Products

catalog_product_category                 Product Categories

catalog_product_price                    Product Price

catalog_product_attribute                Product EAV

cataloginventory_stock                   Stock

catalogrule_rule                         Catalog Rule Product

catalogrule_product                      Catalog Product Rule

catalogsearch_fulltext                   Catalog Search

Step 2: Examine status and index status of an indexers in Magento 2

php bin/magento indexer:status [indexer]

Examine status of category _product indexers

php bin/magento indexer:status catalog_category_product

2.1 Examine status if all indexers

php bin/magento indexer:status

You will get the following results

Category Products:                          Reindex required

Product Categories:                         Reindex required

Product Price:                              Reindex required

Product EAV:                                Reindex required

Stock:                                      Reindex required              

Catalog Rule Product:                       Reindex required

Catalog Product Rule:                      Reindex required

Catalog Search:                            Reindex required

 Step 3: Reindex an indexers

3.1 reindex an indexers

php bin/magento indexer:reindex [indexer]

Reindex stock in Magento 2

php bin/magento indexer:reindex cataloginventory_stock

3.2  reindex all indexers

php bin/magento indexer:reindex [indexer]

Then you will get the following result

Category Products index has been rebuilt successfully in <time>

Product Categories index has been rebuilt successfully in <time>

Product Price index has been rebuilt successfully in <time>

Product EAV index has been restoring successfully in <time>

Stock index has been rebuilt successfully in <time>

Catalog Rule Product index has been rebuilt successfully in <time>

Catalog Product Rule index has been rebuilt successfully in <time>

Catalog Search index has been rebuilt successfully in <time>

Step 4: Examine present configuration of indexers in Magento 2

4.1 Examine configuration of an indexers

php bin/magento indexer:show-mode [indexer]

Examine configuration of catalog_product_price indexer

php bin/magento indexer:show-mode catalog_product_price

4.2 Examine configuration of all indexers

php bin/magento indexer:show-mode

Then you will get the following results

Category Products:                        Update on save    

Product Categories:                       Update on Save

Product Price:                            Update on Save

Product EAV:                              Update on Save

Stock:                                    Update on Save

Catalog Rule Product:                     Update on Save

Catalog Product Rule:                     Update on Save

Catalog Search:                           Update on Save

 Step 5: configure an indexers.configure indexers in Magento 2

php bin/magento indexer:set-mode {realtime|schedule}

Configure Catalog Search index to update real time

php bin/magento indexer:set-mode realtime catalogsearch_fulltext

configure catalog search index to update on schedule

php bin/magento indexer:set-mode schedule catalogsearch_fulltext

5.1 configure all indexers

php bin/magento indexer:set-mode {realtime|schedule}

Configure all indexers to realtime

php bin/magento indexer:set-mode realtime

The above mentioned steps are the simplest process which help you how to organize indexers using Magento 2 using CLI.

Last Update: January 17, 2019  

February 12, 2018   269   Nandini R    Operations    
Total 1 Votes:
0

Tell us how can we improve this post?

+ = Verify Human or Spambot ?

Leave a Reply

Your email address will not be published. Required fields are marked *

Facebook
Twitter
INSTAGRAM
LinkedIn