Magento产品平面数据和目录搜索索引问题

时间:2013-04-11 14:12:57

标签: php mysql magento

我们正在运营拥有8k产品的Magento商店。丝束索引不起作用。抛出一些错误。 产品平面数据错误

Product Flat Data index process unknown error:
exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1005 Can't create table './bofc_magento/#sql-f22_6554c.frm' (errno: 121)' in /var/www/vhosts/beadsofcambay.com/httpdocs/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /var/www/vhosts/beadsofcambay.com/httpdocs/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /var/www/vhosts/beadsofcambay.com/httpdocs/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /var/www/vhosts/beadsofcambay.com/httpdocs/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /var/www/vhosts/beadsofcambay.com/httpdocs/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#4 /var/www/vhosts/beadsofcambay.com/httpdocs/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('ALTER TABLE `ca...', Array)
#5 /var/www/vhosts/beadsofcambay.com/httpdocs/lib/Varien/Db/Adapter/Pdo/Mysql.php(389): Zend_Db_Adapter_Pdo_Abstract->query('ALTER TABLE `ca...', Array)
#6 /var/www/vhosts/beadsofcambay.com/httpdocs/lib/Varien/Db/Adapter/Pdo/Mysql.php(327): Varien_Db_Adapter_Pdo_Mysql->query('ALTER TABLE `ca...')
#7 /var/www/vhosts/beadsofcambay.com/httpdocs/lib/Varien/Db/Adapter/Pdo/Mysql.php(2548): Varien_Db_Adapter_Pdo_Mysql->raw_query('ALTER TABLE `ca...')
#8 /var/www/vhosts/beadsofcambay.com/httpdocs/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(816): Varien_Db_Adapter_Pdo_Mysql->addForeignKey('FK_CAT_PRD_FLAT...', 'catalog_product...', 'entity_id', 'catalog_product...', 'entity_id', 'CASCADE', 'CASCADE')
#9 /var/www/vhosts/beadsofcambay.com/httpdocs/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(1390): Mage_Catalog_Model_Resource_Product_Flat_Indexer->prepareFlatTable(1)
#10 /var/www/vhosts/beadsofcambay.com/httpdocs/app/code/core/Mage/Catalog/Model/Product/Flat/Indexer.php(296): Mage_Catalog_Model_Resource_Product_Flat_Indexer->reindexAll()
#11 /var/www/vhosts/beadsofcambay.com/httpdocs/app/code/core/Mage/Catalog/Model/Product/Indexer/Flat.php(336): Mage_Catalog_Model_Product_Flat_Indexer->reindexAll()
#12 /var/www/vhosts/beadsofcambay.com/httpdocs/app/code/core/Mage/Index/Model/Process.php(207): Mage_Catalog_Model_Product_Indexer_Flat->reindexAll()
#13 /var/www/vhosts/beadsofcambay.com/httpdocs/app/code/core/Mage/Index/Model/Process.php(253): Mage_Index_Model_Process->reindexAll()
#14 /var/www/vhosts/beadsofcambay.com/httpdocs/shell/indexer.php(158): Mage_Index_Model_Process->reindexEverything()
#15 /var/www/vhosts/beadsofcambay.com/httpdocs/shell/indexer.php(198): Mage_Shell_Compiler->run()
#16 {main}

目录搜索索引

Catalog Search Index index process unknown error:
exception 'Zend_Cache_Exception' with message 'Could not determine temp directory, please specify a cache_dir manually' in /var/www/vhosts/beadsofcambay.com/httpdocs/lib/Zend/Cache.php:209
Stack trace:
#0 /var/www/vhosts/beadsofcambay.com/httpdocs/lib/Zend/Cache/Backend.php(197): Zend_Cache::throwException('Could not deter...')
#1 /var/www/vhosts/beadsofcambay.com/httpdocs/lib/Zend/Cache/Backend/File.php(123): Zend_Cache_Backend->getTmpDir()
#2 /var/www/vhosts/beadsofcambay.com/httpdocs/lib/Zend/Cache.php(153): Zend_Cache_Backend_File->__construct(Array)
#3 /var/www/vhosts/beadsofcambay.com/httpdocs/lib/Zend/Cache.php(94): Zend_Cache::_makeBackend('File', Array, false, false)
#4 /var/www/vhosts/beadsofcambay.com/httpdocs/lib/Zend/Locale/Data.php(940): Zend_Cache::factory('Core', 'File', Array, Array)
#5 /var/www/vhosts/beadsofcambay.com/httpdocs/lib/Zend/Locale.php(668): Zend_Locale_Data::getContent('en_US', 'date', NULL)
#6 /var/www/vhosts/beadsofcambay.com/httpdocs/app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php(763): Zend_Locale::getTranslation(NULL, 'date', Object(Zend_Locale))
#7 /var/www/vhosts/beadsofcambay.com/httpdocs/app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php(699): Mage_CatalogSearch_Model_Resource_Fulltext->_getStoreDate(1, NULL)
#8 /var/www/vhosts/beadsofcambay.com/httpdocs/app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php(634): Mage_CatalogSearch_Model_Resource_Fulltext->_getAttributeValue(145, NULL, 1)
#9 /var/www/vhosts/beadsofcambay.com/httpdocs/app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php(230): Mage_CatalogSearch_Model_Resource_Fulltext->_prepareProductIndex(Array, Array, 1)
#10 /var/www/vhosts/beadsofcambay.com/httpdocs/app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php(128): Mage_CatalogSearch_Model_Resource_Fulltext->_rebuildStoreIndex(1, NULL)
#11 /var/www/vhosts/beadsofcambay.com/httpdocs/app/code/core/Mage/CatalogSearch/Model/Fulltext.php(83): Mage_CatalogSearch_Model_Resource_Fulltext->rebuildIndex(NULL, NULL)
#12 /var/www/vhosts/beadsofcambay.com/httpdocs/app/code/core/Mage/CatalogSearch/Model/Indexer/Fulltext.php(446): Mage_CatalogSearch_Model_Fulltext->rebuildIndex()
#13 /var/www/vhosts/beadsofcambay.com/httpdocs/app/code/core/Mage/Index/Model/Process.php(207): Mage_CatalogSearch_Model_Indexer_Fulltext->reindexAll()
#14 /var/www/vhosts/beadsofcambay.com/httpdocs/app/code/core/Mage/Index/Model/Process.php(253): Mage_Index_Model_Process->reindexAll()
#15 /var/www/vhosts/beadsofcambay.com/httpdocs/shell/indexer.php(158): Mage_Index_Model_Process->reindexEverything()
#16 /var/www/vhosts/beadsofcambay.com/httpdocs/shell/indexer.php(198): Mage_Shell_Compiler->run()
#17 {main} 

两个索引都是从命令行运行的。我用Google搜索了两个错误但没有找到任何合适的解决方案。

5 个答案:

答案 0 :(得分:3)

几天前我遇到了同样的问题。

1 - 请进行数据库备份

2 - 关闭Magento中的Use Flat Product和Category选项,并将Index模式从Product Flat Data切换到Manual update;

3 - 现在进入你的数据库。删除catalog_product_flat_xx表;

4 - 您必须通过SSH重新编制目录索引。它应该是这样的:

usr/local/bin/php public_html/shell/indexer.php --reindex catalog_product_flat

Magento将为每个商店创建新表。我可能需要一段时间。

完成后,您可以激活Flat产品选项并查看Magento是否可以自行执行reindex。

答案 1 :(得分:1)

截断Product Flat Data,然后再次运行此脚本。 应该是外键约束问题。

答案 2 :(得分:1)

当我尝试手动更改具有FK(关系)的列时,我看到了该错误。 截断平面索引表应该让它消失 - 如果失败,也可以尝试DELETE FROM而不是TRUNCATE。

在前端设置了多少个可见属性(并添加到平面表中)? MySQL每行限制为64k,如果你破坏它就会发生不好的事情(比如损坏的表......)

第二个错误看起来只是错误的缓存设置(local.xml)或var文件夹的文件权限问题。

答案 3 :(得分:1)

我无法重新索引catalog_product_flat索引流程。花了一天时间在互联网上尝试了几种解决方案。我能够解决这个问题。 以下是步骤。

  1. 创建面向索引问题的Magento Db的克隆。
  2. 将数据库转储到新创建的数据库中。
  3. 截断单个商店的表catalog_product_flat_1,对于多个商店,会有多个表catalog_product_flat_*,其中*是商店ID。这里截断了所有表格。
  4. 将mangento运行实例指向新创建的数据库并配置数据库,以使该站点正常运行。
  5. 现在运行命令php document_root/shell/indexer.php --reindex catalog_product_flat或尝试从管理员重新编制索引。 php document_root/shell/indexer.php --reindexall用于重新索引所有流程。

答案 4 :(得分:-1)

我在目录搜索中重新索引时面临同样的问题... 10天后我找到了解决方案。

目录搜索索引错误我得到了:

  

例外' PDOException'消息' SQLSTATE [HY000]:常规错误:   1785当@@ GLOBAL.ENFORCE_GTID_CONSISTEN CY = 1时,更新为   非事务性表只能在自动提交中完成   语句或单语句事务,永远不会相同   声明作为事务表的更新。'

解决方案是:

  1. 删除表catalogsearch_fulltext
  2. 使用现有结构再次创建catalogsearch_fulltext表。
  3. 使用提及的查询更新表catalogsearch_query

    UPDATE catalogsearch_query SET is_processed = 0

  4. 然后打开SSH并运行命令使其再次运行:

    [~/public_html/shell]# php indexer.php reindexall