本文介绍了复合分片键块边界的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

复合分片键如何用于生成新块?我的意思是,如果我有像

How are compound shard key used to generate new chunks? I mean, if I have a shard key like

{key1:1,key2:1}

{key1 : 1, key2 : 1}

并且我们正在填充集合,在有两个键的情况下,MongoDB如何创建新的块边界?我可以在配置服务器中看到它们,但看不到它们.他们看起来像

and the collection is being populated as we go, how does MongoDB create the new chunks boundaries given that there are two keys? I can see them in the config server BUT I can not read them. they look like

[最小键1,最小键2] ---> [最大键1,最大键2]

[min key1,min key2] ---> [max key1, max key2]

很多时候,最小键2 > 最大键2 .这有什么意义?

and many often, min key 2> max key 2. How does that make sense?

换句话说,如果分片键是复合的,那么如何在新块上设置最小和最大块?

In other words, how are the chunks min and max being set on new chunks given the shard key is compound?

键1的类型为字符串,键2的类型为int

key 1 is of type string and key 2 is of type int

如果您能举例说明,我将不胜感激.

I would appreciate it if you could explain it by an example.

推荐答案

边界总是从正无穷大到负无穷大.当您插入时,它将把初始块分解成较小的块.

The boundary is always from positive to negative infinity. As you insert it will break that initial chunk into smaller ones.

这是一个应该回答您问题的线程.

这篇关于复合分片键块边界的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-19 01:28