[MongoDB] - 对于"OperationFailed: Sort operation used more than the maximum 33554432 bytes of RAM"问题的优化

背景:MongoDB v4.2.7

错误:OperationFailed: Sort operation used more than the maximum 33,554,432 bytes of RAM. Add an index, or specify a smaller limit.’ on server

修改:增加 sort memory

*** 修改当前运行时(重启MongoDB失效) ***

1. 查询现有配置

db.adminCommand({getParameter: '*'})

 

2. 更新配置(MongoDB v4.2

db.adminCommand({"setParameter":1,"internalQueryExecMaxBlockingSortBytes":335544320})

更新配置(MongoDB v4.4
参考资料:https://jira.mongodb.org/browse/SERVER-44053

db.adminCommand({"setParameter":1,"internalQueryMaxBlockingSortMemoryUsageBytes":335544320})

 

*** 持久化到配置文件中(重启MongoDB有效) *** 

更新配置(MongoDB v4.2

setParameter:
  internalQueryExecMaxBlockingSortBytes: 335544320

更新配置(MongoDB v4.4

setParameter:
  internalQueryMaxBlockingSortMemoryUsageBytes: 335544320

 

参考资料

https://mobilemonitoringsolutions.com/memory-errors-mongodb-resolve/
https://www.cnblogs.com/dgshubo/p/12397775.html
https://jira.mongodb.org/browse/SERVER-44053

posted @ 2020-09-23 12:46  jinzesudawei  阅读(837)  评论(0编辑  收藏  举报