使用命令行刷新Magento索引管理

magento索引管理
magento索引管理

当我们网站商品很多的时候,比如有几千件,我们刷新Magento的索引管理(Index Management)经常会失败。那么后台刷新不了,我们还可以通过命令行来刷新。使用命令行来刷新索引管理会极大降低系统消耗,容易成功。
我们来看下步骤,如果你在使用linux服务器,登入你的ssh客户端,切换目录到你magento根文件夹中名字是shell的文件中。
在此文件夹中输入如下命令

php -f indexer.php -- -reindex catalog_url

它的意思是刷新Catalog Url Rewrites即网址重写。成功后会有成功提示,如:Catalog URL Rewrites index was rebuilt successfully

magento使用Shell刷新索引管理
magento使用Shell刷新索引管理

我们来看下有哪些索引管理,可以使用Shell的命令行来刷新,如下

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

如上分别对应后每项台的索引管理。

命令执行后需要耐心等待一段时间,因你商品数量和你服务器性能决定等待多久。注意命令中reinde前一共是三个英文横线。如有代码错误提示,直接黏贴本文的命令或者
如下参考文章的命令,直接修改执行参数即可。

参考文章:http://inchoo.net/ecommerce/magento/executing-magento-indexer-from-shell/

转载表明出处:www.hellokeykey.com

《使用命令行刷新Magento索引管理》有14个想法

  1. 我通过putty登陆SSH,输入命令报错,这是啥回事
    -bash-3.2$ php -f indexer.php — -reindex catalog_url

    Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /home/content/86/8410586/html/shell/indexer.php on line 43

  2. 您好keykey,在刷新时提示:
    Failed loading /usr/lib/kloxophp/ioncube/ioncube_loader_lin_5.3.so: /usr/lib/kl oxophp/ioncube/ioncube_loader_lin_5.3.so: cannot open shared object file: No such file or directory
    Cannot load Zend Extension Manager – it was built with configuration 1.2.0, wher eas running engine is API220090626,NTS
    cannot open shared object file: No suc
    该如何解决呢

      1. 我是清空产品数据后出现的category flat data 索引失败问题啊 求解 各种方法都试过了啊

  3. 钥匙你好:
    刷新 catalog_category_flat 报错如下:
    Product Flat Data index process unknown error:
    exception ‘PDOException’ with message ‘SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: …………………….
    请教一下 该怎么办?

  4. 你好,使用命令行刷新Magento索引管理,按照你的文章http://www.hellokeykey.com/magento-shell-reindex-index-management/,执行命令后,出现-bash: php: command not found,这个怎么解决?

  5. 你好 钥匙,php -f indexer.php — -reindex catalog_url
    执行之后10秒左右 就结束了 ,任何提示都没有。重复执行命令,结果还是那样,就1000多个产品,后台索引处一直提示那个红色的

  6. 我是新手,请问为什么要进行Magento索引管理呀?目前站点后台已经导入图片了,可是前台其他信息都显示,就是没有图片。指点下可能的原因呀?后台的图片设置是正确的,并且在后台可以看到上传的图片。

评论已关闭。