monogdb"errmsg"中的错误; :" WiredTigerIndex :: insert:密钥太大而无法索引,失败 [英] error in monogdb "errmsg" : "WiredTigerIndex::insert: key too large to index, failing

查看:314
本文介绍了monogdb"errmsg"中的错误; :" WiredTigerIndex :: insert:密钥太大而无法索引,失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在mongo中创建索引:

I'm creating a index in mongo:

db.table.createIndex({"chr" : 1, "Start" : 1, "End" : 1, "Ref" : 1, "Alt" : 1}) 

它运行一段时间并给出错误消息:

It runs for some time and gives an error msg:

error in monogdb "errmsg" : "WiredTigerIndex::insert: key too large to index, failing

如何解决此错误?

推荐答案

在MongoDB中,自2.6开始,索引条目的总大小必须小于1024字节. 此处的文档

In MongoDB, since 2.6, the total size of an index entry must be less than 1024 bytes. Documentation here

换句话说,至少一个文档在您要索引的字段之一中具有很大的价值.

In other terms, at least one of your documents has a large value in one of the field you are trying to index.

一般来说,索引这样的大值不是一个好主意,因为它会创建一个大索引,与较小的索引相比效率较低,并且需要占用RAM中的更多空间,可以在MongoDB节点上更好地使用它

It's not a good idea in general to index very large values like that because it creates a big index which is less efficient compared to a smaller one and it takes more space in RAM which could be put to better use on a MongoDB node.

您可以使用以下代码:mongod --setParameter failIndexKeyTooLong=false.

You could use this : mongod --setParameter failIndexKeyTooLong=false.

但这看起来不是一个好主意.如果要索引的文本较大,则应考虑使用全文索引",也可以使用哈希索引".

But it doesn't look like a good idea. If you have a large text to index, you should consider using the Full Text index or you could use a Hashed index.

这篇关于monogdb"errmsg"中的错误; :" WiredTigerIndex :: insert:密钥太大而无法索引,失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆