背景: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