Mongodb搜索报错:Sort operation used more than the maximum 33554432 bytes of RAM

问题咨询 · Fecmall · 于 6年前 发布 · 5278 次阅读

mongodb full search 搜索报错:

An Error occurred while handling another error:
exception 'ReflectionException' with message 'Method fecshop\services\search\MongoSearch::getSearchProductColl() does not exist' in /www/web/dropship/vendor/yiisoft/yii2/web/ErrorHandler.php:195
Stack trace:
#0 /www/web/dropship/vendor/yiisoft/yii2/web/ErrorHandler.php(195): ReflectionMethod->__construct('fecshop\\service...', 'getSearchProduc...')
#1 /www/web/dropship/vendor/yiisoft/yii2/views/errorHandler/callStackItem.php(26): yii\web\ErrorHandler->addTypeLinks('fecshop\\service...')
#2 /www/web/dropship/vendor/yiisoft/yii2/base/View.php(330): require('/www/web/dropsh...')
#3 /www/web/dropship/vendor/yiisoft/yii2/base/View.php(250): yii\base\View->renderPhpFile('/www/web/dropsh...', Array)
#4 /www/web/dropship/vendor/yiisoft/yii2/web/ErrorHandler.php(249): yii\base\View->renderFile('@yii/views/erro...', Array, Object(yii\web\ErrorHandler))
#5 /www/web/dropship/vendor/yiisoft/yii2/web/ErrorHandler.php(304): yii\web\ErrorHandler->renderFile('@yii/views/erro...', Array)
#6 /www/web/dropship/vendor/yiisoft/yii2/web/ErrorHandler.php(326): yii\web\ErrorHandler->renderCallStackItem('/www/web/dropsh...', 126, 'fecshop\\service...', 'getSearchProduc...', Array, 9)
#7 /www/web/dropship/vendor/yiisoft/yii2/views/errorHandler/exception.php(381): yii\web\ErrorHandler->renderCallStack(Object(yii\mongodb\Exception))
#8 /www/web/dropship/vendor/yiisoft/yii2/base/View.php(330): require('/www/web/dropsh...')
#9 /www/web/dropship/vendor/yiisoft/yii2/base/View.php(250): yii\base\View->renderPhpFile('/www/web/dropsh...', Array)
#10 /www/web/dropship/vendor/yiisoft/yii2/web/ErrorHandler.php(249): yii\base\View->renderFile('@yii/views/erro...', Array, Object(yii\web\ErrorHandler))
#11 /www/web/dropship/vendor/yiisoft/yii2/web/ErrorHandler.php(116): yii\web\ErrorHandler->renderFile('@yii/views/erro...', Array)
#12 /www/web/dropship/vendor/yiisoft/yii2/base/ErrorHandler.php(111): yii\web\ErrorHandler->renderException(Object(yii\mongodb\Exception))
#13 [internal function]: yii\base\ErrorHandler->handleException(Object(yii\mongodb\Exception))
#14 {main}
Previous exception:
exception 'MongoDB\Driver\Exception\RuntimeException' with message 'Executor error during find command: OperationFailed: Sort operation used more than the maximum 33554432 bytes of RAM. Add an index, or specify a smaller limit.' in /www/web/dropship/vendor/yiisoft/yii2-mongodb/Command.php:289
Stack trace:
#0 /www/web/dropship/vendor/yiisoft/yii2-mongodb/Command.php(289): MongoDB\Driver\Server->executeQuery('dropship.full_s...', Object(MongoDB\Driver\Query))
#1 /www/web/dropship/vendor/yiisoft/yii2-mongodb/Command.php(617): yii\mongodb\Command->query('<span class="st...', '[<span class="s...')
#2 /www/web/dropship/vendor/yiisoft/yii2-mongodb/Collection.php(218): yii\mongodb\Command->find('<span class="st...', '[<span class="s...', '[<span class="s...')
#3 /www/web/dropship/vendor/fancyecommerce/fecshop/services/search/MongoSearch.php(245): yii\mongodb\Collection->find('[<span class="s...', '[<span class="s...', '[<span class="s...')
#4 /www/web/dropship/vendor/fancyecommerce/fecshop/services/search/MongoSearch.php(196): fecshop\services\search\MongoSearch->fullTearchText('[<span class="s...')
#5 [internal function]: fecshop\services\search\MongoSearch->actionGetSearchProductColl('[<span class="s...', '[<span class="s...', '<span class="nu...', '<span class="nu...', '...')
#6 /www/web/dropship/vendor/fancyecommerce/fecshop/services/Service.php(48): call_user_func_array('[<span class="t...', '[[<span class="...')
#7 /www/web/dropship/vendor/fancyecommerce/fecshop/services/Search.php(126): fecshop\services\Service->__call('<span class="st...', '[[<span class="...')
#8 /www/web/dropship/vendor/fancyecommerce/fecshop/services/Search.php(126): fecshop\services\search\MongoSearch->getSearchProductColl(Array, Array, 1, 40, 1000)
#9 [internal function]: fecshop\services\Search->actionGetSearchProductColl(Array, Array, 1, 40, 1000)
#10 /www/web/dropship/vendor/fancyecommerce/fecshop/services/Service.php(48): call_user_func_array(Array, Array)
#11 /www/web/dropship/vendor/fancyecommerce/fecshop/app/appfront/modules/Catalogsearch/block/index/Index.php(364): fecshop\services\Service->__call('getSearchProduc...', Array)
#12 /www/web/dropship/vendor/fancyecommerce/fecshop/app/appfront/modules/Catalogsearch/block/index/Index.php(364): fecshop\services\Search->getSearchProductColl(Array, Array, 1, 40, 1000)
#13 /www/web/dropship/vendor/fancyecommerce/fecshop/app/appfront/modules/Catalogsearch/block/index/Index.php(43): fecshop\app\appfront\modules\Catalogsearch\block\index\Index->getSearchProductColl()
#14 /www/web/dropship/vendor/fancyecommerce/fecshop/app/appfront/modules/Catalogsearch/controllers/IndexController.php(28): fecshop\app\appfront\modules\Catalogsearch\block\index\Index->getLastData()
#15 [internal function]: fecshop\app\appfront\modules\Catalogsearch\controllers\IndexController->actionIndex()
#16 /www/web/dropship/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#17 /www/web/dropship/vendor/yiisoft/yii2/base/Controller.php(156): yii\base\InlineAction->runWithParams(Array)
#18 /www/web/dropship/vendor/yiisoft/yii2/base/Module.php(523): yii\base\Controller->runAction('', Array)
#19 /www/web/dropship/vendor/yiisoft/yii2/web/Application.php(102): yii\base\Module->runAction('catalogsearch/i...', Array)
#20 /www/web/dropship/vendor/yiisoft/yii2/base/Application.php(380): yii\web\Application->handleRequest(Object(fecshop\yii\web\Request))
#21 /www/web/dropship/appfront/web/index.php(68): yii\base\Application->run()
#22 {main}

Next exception 'yii\mongodb\Exception' with message 'Executor error during find command: OperationFailed: Sort operation used more than the maximum 33554432 bytes of RAM. Add an index, or specify a smaller limit.' in /www/web/dropship/vendor/yiisoft/yii2-mongodb/Command.php:295
Stack trace:
#0 /www/web/dropship/vendor/yiisoft/yii2-mongodb/Command.php(617): yii\mongodb\Command->query('<span class="st...', '[<span class="s...')
#1 /www/web/dropship/vendor/yiisoft/yii2-mongodb/Collection.php(218): yii\mongodb\Command->find('<span class="st...', '[<span class="s...', '[<span class="s...')
#2 /www/web/dropship/vendor/fancyecommerce/fecshop/services/search/MongoSearch.php(245): yii\mongodb\Collection->find('[<span class="s...', '[<span class="s...', '[<span class="s...')
#3 /www/web/dropship/vendor/fancyecommerce/fecshop/services/search/MongoSearch.php(196): fecshop\services\search\MongoSearch->fullTearchText('[<span class="s...')
#4 [internal function]: fecshop\services\search\MongoSearch->actionGetSearchProductColl('[<span class="s...', '[<span class="s...', '<span class="nu...', '<span class="nu...', '...')
#5 /www/web/dropship/vendor/fancyecommerce/fecshop/services/Service.php(48): call_user_func_array('[<span class="t...', '[[<span class="...')
#6 /www/web/dropship/vendor/fancyecommerce/fecshop/services/Search.php(126): fecshop\services\Service->__call('<span class="st...', '[[<span class="...')
#7 /www/web/dropship/vendor/fancyecommerce/fecshop/services/Search.php(126): fecshop\services\search\MongoSearch->getSearchProductColl(Array, Array, 1, 40, 1000)
#8 [internal function]: fecshop\services\Search->actionGetSearchProductColl(Array, Array, 1, 40, 1000)
#9 /www/web/dropship/vendor/fancyecommerce/fecshop/services/Service.php(48): call_user_func_array(Array, Array)
#10 /www/web/dropship/vendor/fancyecommerce/fecshop/app/appfront/modules/Catalogsearch/block/index/Index.php(364): fecshop\services\Service->__call('getSearchProduc...', Array)
#11 /www/web/dropship/vendor/fancyecommerce/fecshop/app/appfront/modules/Catalogsearch/block/index/Index.php(364): fecshop\services\Search->getSearchProductColl(Array, Array, 1, 40, 1000)
#12 /www/web/dropship/vendor/fancyecommerce/fecshop/app/appfront/modules/Catalogsearch/block/index/Index.php(43): fecshop\app\appfront\modules\Catalogsearch\block\index\Index->getSearchProductColl()
#13 /www/web/dropship/vendor/fancyecommerce/fecshop/app/appfront/modules/Catalogsearch/controllers/IndexController.php(28): fecshop\app\appfront\modules\Catalogsearch\block\index\Index->getLastData()
#14 [internal function]: fecshop\app\appfront\modules\Catalogsearch\controllers\IndexController->actionIndex()
#15 /www/web/dropship/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#16 /www/web/dropship/vendor/yiisoft/yii2/base/Controller.php(156): yii\base\InlineAction->runWithParams(Array)
#17 /www/web/dropship/vendor/yiisoft/yii2/base/Module.php(523): yii\base\Controller->runAction('', Array)
#18 /www/web/dropship/vendor/yiisoft/yii2/web/Application.php(102): yii\base\Module->runAction('catalogsearch/i...', Array)
#19 /www/web/dropship/vendor/yiisoft/yii2/base/Application.php(380): yii\web\Application->handleRequest(Object(fecshop\yii\web\Request))
#20 /www/web/dropship/appfront/web/index.php(68): yii\base\Application->run()
#21 {main}
共收到 3 条回复
Fecmall#16年前 0 个赞

报错信息为: Executor error during find command: OperationFailed: Sort operation used more than the maximum 33554432 bytes of RAM. Add an index, or specify a smaller limit.

根据文档: https://docs.mongodb.com/manual/reference/command/getParameter/

可以设置一下参数:internalQueryExecMaxBlockingSortBytes

mongodb 3.x有效

因此,可以在 /etc/mongod.conf 中添加参数,然后重启mongodb即可

# mongod.conf

# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /data/var/log/mongodb/mongod.log

# Where and how to store data.
storage:
  dbPath: /data/var/lib/mongo
  journal:
    enabled: true
#  engine:
#  mmapv1:
#  wiredTiger:

# how the process runs
processManagement:
  fork: true  # fork and run in background
  pidFilePath: /var/run/mongodb/mongod.pid  # location of pidfile

# network interfaces
net:
  port: 27017
  bindIp: 127.0.0.1  # Listen to local interface only, comment to listen on all interfaces.
setParameter:
  internalQueryExecMaxBlockingSortBytes: 335544320

#security:

#operationProfiling:

#replication:

#sharding:

## Enterprise-Only Options

#auditLog:

#snmp:

上面是加完后,我的mongodb的配置

Fecmall#26年前 0 个赞

上面我是将默认的32mb,改成了320MB。这个看自己的机器的内存进行设置。

添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册
Your Site Analytics