Magento 2:重建索引不起作用

Magento 2: reindexing is not working

我无法在 magento 2 中执行 重建索引。在 google 之后,我得到了我们可以使用 shell 命令重新索引的解决方案

php dev/shell/indexer.php reindexall

但是报错

Could not open input file: dev/shell/indexer.php

因为我在 dev 中看不到 shell 文件夹。

在 magento2 中,shell 目录下没有 indexer.php。 如果你 运行 magento cron:run 两次,它将重建索引。

命令行界面

Reindex CLI

没错。为了使索引器保持最新,运行 cron 作为 Magento file system owner.

一种方法是为该用户设置一个 crontab:

*/1 * * * * php <your Magento install dir>/bin/magento cron:run &

详情:http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-cron.html

shell folder are reside under dev directory of magento2 root.
Open your cmd.
go to magento bin directory path using CLI.
Your path like C:\wamp\www\magento2\bin.(if wamp is installed on C directory)
Now You have to enter command php magento indexer:reindex
All indexing are successfully reindex.

您可以在 magento 核心文档中查看更多信息 link:http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-index.html

这对我有用。

您可以手动 运行 重建索引。转到 magento 安装文件夹根目录中的 magento bin 文件夹和 运行: $ php magento indexer:reindex

参考:http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-index.html

更好的方法是配置cronjob。按照此处的指南操作:http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-cron.html#config-cli-cron-bkg

Magento2 设计为不在管理员中手动重建索引。参考:https://github.com/magento/magento2/issues/824

在您的 magento 根目录中输入:

php bin/magento indexer:reindex

这将执行完整的重建索引。如果你只想重新索引其中一个索引器,命令如下:

php bin/magento indexer:reindex indexer_name

其中 indexer_name 可以通过键入找到:

php bin/magento indexer:info

通过终端从 magento 根启动此命令

重新索引所有:php bin/magento indexer:reindex

重新索引 perticuler : php bin/magento indexer:reindex indexer_name

哪里indexer_name应该是 catalog_category_product,catalog_product_category,catalog_product_price,catalog_product_attribute,cataloginventory_stock,catalogrule_rule,catalogrule_product,catalogsearch_fulltext.

如果您在 Linux 上使用 xampp,CLI 命令将是

/opt/lampp/bin/php bin/magento indexer:reindex

使用命令提示符,

转到您的 Magento 根目录。

cd your_magento_directory

然后 运行 按照命令

php bin/magento indexer:reindex

如果你想专门做重新索引,那么你的评论是:

php bin/magento indexer:reindex [indexer] 

对于 windows 系统,您必须按照以下步骤操作:

步骤:1 创建环境变量

Go to My Computer -> Right Click -> Properties -> Advanced System Settings -> Advanced -> Environment Variable -> System Variable -> Path -> Edit -> Enter you xampp->php path (Example : E:\xampp\php).

步骤:2 打开 CMD 并 运行 在您的 Magento 项目的根文件夹中执行以下命令

php bin/magento indexer:reindex

http://devdocs.magento.com/guides/v2.0/comp-mgr/prereq/prereq_compman-ulimit.html 为网络服务器用户设置 ulimit

可选地设置用户的值 Bash shell:

如果您还没有这样做,请切换到 Magento 文件系统所有者。 在文本编辑器中打开 /home//.bashrc。 添加以下行:

ulimit -s 65536 保存对 .bashrc 的更改并退出文本编辑器。