mongodb报错一例
开发程序报错信息:
Caused by: com.mongodb.MongoException: Executor error:
OperationFailed: Sort operation used more than the maximum 33554432 bytes of RAM. Add an index, or specify a smaller limit.
从程序报错中可以看到是排序的内存不足。
解决办法:3.x版本
use admin
db.adminCommand({getParameter:"*"}) #查看参数的配置
db.adminCommand({setParameter:1, internalQueryExecMaxBlockingSortBytes:335544320}) #修改内存为排序为320M
其他解决方案:(通过创建索引方式)
db.你的collection.createIndex({"你的字段": -1}),此处 -1 代表倒序,1 代表正序;
db.你的collecton.getIndexes();
参考官方文档:
https://docs.mongodb.com/manual/reference/method/cursor.sort/#cursor.sort
https://docs.mongodb.com/manual/tutorial/optimize-query-performance-with-indexes-and-projections/
对于以上问题推荐解决方案:
1.优化查询和索引。
2.减少输出列(限制输出列个数)或行(如limit函数,或限制输入查询_id数量)。
3.将查询分2步,第1步只输出_id,第2步再通过_id查明细。
都可以解决内存中排序溢出问题。
mongodb报错一例的更多相关文章
- sudo brew install mongodb报错
报错信息如下: Error: Running Homebrew as root is extremely dangerous and no longer supported. As Homebrew ...
- mongoDB报错Cannot find module '../build/Release/bson'
打算用nodejs写一个blog系统,发现nodejs还是存在很多的坑.在使用mongodb时遇到如下报错问题: { [Error: Cannot find module '../build/Rele ...
- ubuntu mongodb报错:mongo - couldn't connect to server 127.0.0.1:27017
在进入mongo的时候,出现在下面错误信息.那如何解决呢? 标记一下,以便下次理碰的到时候,有个参考. warning: Failed to connect to 127.0.0.1:27017, r ...
- springboot+mongodb报错Caused by: java.net.ConnectException: Connection refused (Connection refused)
com.mongodb.MongoSocketOpenException: Exception opening socket at com.mongodb.connection.SocketStrea ...
- mongodb报错:connection refused because too many open connections: 819
问题: 发现mongodb无法连接,查看mongodb日志,出现大量的如下报错: [initandlisten] connection refused because too many open co ...
- Kettle6.1连接MongoDB报错
配置好mongodb连接之后,点击预览报下面的错: 报错: java.lang.NoClassDefFoundError: javax/crypto/spec/PBEKeySpec a ...
- mongodb 报错 not authorized on admin to execute command【 version 3.2.18 】
mongodb version 3.2.18 测试问题: 分析: 从报错内容上看是权限不够,但不明了为什么,因为已经使用的超级用户权限: { "_id" : "admin ...
- 启动mongodb报错,无法连接mongodb
报错原因如下: MongoDB shell version v3.4.2 connecting to: mongodb://127.0.0.1:27017 --01T12:: W NETWORK [t ...
- mongodb安装及安装MongoDB报错Verify that you have sufficient privileges to start system services解决方法
1.点击安装包mongodb-win32-x86_64-2012plus-4.2.2-signed进行安装 2.点击next 3.接受协议,点击next 4.点击自定义安装 选择安装路径,建议默认C盘 ...
随机推荐
- codevs 2602 最短路径问题——良心题解
2602 最短路径问题 时间限制: 1 s 空间限制: 32000 KB 题目等级 : 黄金 Gold 题解 题目描述 Description 平面上有n个点(n<=100),每个点的坐标均在- ...
- 9day条件语句和基本数据类型
1基本数据类型: 字符串‘’," ",''' ''' 单引号,双引号,三引号 加法: n1='ruser' n2='sb' n3=n1+n2 print(n3) 乘法: n1='r ...
- 爬虫系列(四) 用urllib实现英语翻译
这篇文章我们将以 百度翻译 为例,分析网络请求的过程,然后使用 urllib 编写一个英语翻译的小模块 1.准备工作 首先使用 Chrome 浏览器打开 百度翻译,这里,我们选择 Chrome 浏览器 ...
- Git 基础教程 之 远程仓库
① 注册GitHub账号 由于本地Git仓库和GitHub仓库之间的传输是SSH加密的,所以需要一点设置: a, 创建SSH Key 在用户主目录下,看是否有 .ssh 目录,若无 ...
- Spring Cloud系列(三) 应用监控与管理Actuator
Spring Cloud系列(二) 应用监控与管理Actuator 前言:要想使用Spring Cloud ,Spring Boot 提供的spring-boot-starter-actuator模块 ...
- orcale 基本查询(1)
orcale 基本查询 查询当前用户下的所有表: select * from tab; 查询表结构: desc 表名设置行宽: set linesize 120;设置列宽: 数值类型: col 列名 ...
- 向现有的磁盘组加入/删除ASM磁盘
ASM磁盘组支持动态扩展,我们可以向现有的磁盘组动态加入新的磁盘,新磁盘加入后,Oracle通过后台RBAL进行Rebalance,将当前的数据均衡到新增加的磁盘上.Drop磁盘亦会Rebalance ...
- Cloudera 5.8.3 SolrCloud+HDFS的索引数据备份和恢复。(需重启solr进程。)
一.备份基于HDFS的solrCloud集合数据 1.确认要备份的solr文件夹. /solr/history_customer_collection_test 2.开启HDFS快照功能. hdfs ...
- POJ 3130
这题,加了精度错了,不加精度反而对了... #include <iostream> #include <cstdio> #include <cstring> #in ...
- 生成字符Banner
生成字符Banner http://patorjk.com/software/taag __ _______/ |_ ____ ____ ____ / ___/\ __\/ _ \ / \ / _ \ ...