Manage indexers in magento 2

For managing indexers in magento 2 through cli, you need to login your server. Make sure you have write file permissions.Now change your directory to <Magento insall dir>/bin. For example your magento 2 is installed in /var/www/html then you need change directory to /var/www/html/bin. To see the indexers information type the below command.
php magento indexer:info
You will see the list of all indexers with description like this.
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


To check the status of indexers, you need to type the below command
magento indexer:status [indexer]
here [indexer] is space separated list of indexers like
magento indexer:status  catalog_category_product catalog_product_category catalog_product_price 
Or you may omit this [indexer] option to know the status of all indexers like below
magento indexer:status
For rendexing indexers, we need to run below command
php magento indexer:reindex [indexer]
[indexer] is space separated list of indexers. use this option, If you want to re-index specific indexer
php magento indexer:reindex  catalog_category_product catalog_product_category catalog_product_price
Or you may omit this to re-indexall indexers.
php magento indexer:reindex
Now its time to configure the indexers mode. To know the mode of indexers, type the below command
php magento indexer:show-mode [indexer]
Now no need to say that [indexer] is list of space separated indexers and we may omit this. We have two modes "realtime" and "schedule". Mode "realtime" indexed data as soon as admin make change like save product etc. And "schedule" mode works through cron job. You can set mode as per your requirement through given commands.
magento indexer:set-mode {realtime|schedule} [indexer]
[indexer] is space separated list of indexers. For realtime mode type
php magento indexer:set-mode realtime [indexer]
And for scheduled
php magento indexer:set-mode schedule [indexer]