简体   繁体   English

无法在3节点ArangoDB集群中执行分片

[英]Not able to perform sharding in a 3 node ArangoDB cluster

I have deployed a 3 node cluster in my local (Using Docker) and created a collection (noOfShards = 3 and replicationFactor=1). 我已经在本地(使用Docker)中部署了3个节点的集群,并创建了一个集合(noOfShards = 3和ReplicationFactor = 1)。 However, when I create a document in one of the nodes, it is getting replicated in all the three nodes. 但是,当我在一个节点中创建文档时,该文档将在所有三个节点中复制。 I was expecting it to be distributed, based on my shard key. 我期望基于我的分片密钥来分发它。

I am not allowed to created a collection with replication factor of 0. My main intention is to shard the documents in my collection such that they are evenly distributed in the 3 nodes, based on the shard_key. 我不允许创建复制因子为0的集合。我的主要目的是基于shard_key对我的集合中的文档进行分片,以使其均匀分布在3个节点中。 I am really not concerned with the replication. 我真的不关心复制。

Any idea what I am doing wrong here ? 知道我在做什么错吗?

I personally believe what you did was Replication, which is not what you want to do for your requirement, what you should be doing is Sharding and this is very clearly highlighted in ArangoDB documentation: 我个人认为您所做的是复制,这不是您要满足的要求,您应该做的是分片,并且在ArangoDB文档中非常清楚地强调了这一点:

https://docs.arangodb.com/3.2/Manual/Administration/Sharding/ https://docs.arangodb.com/3.2/Manual/Administration/Sharding/


Creating a simple sharded collection 创建一个简单的分片集合

127.0.0.1:8529@_system> db._create("sharded_collection", { "numberOfShards": 3 });

In brief, it allows you to create collections that are sharded across your cluster which essentially meets your requirement. 简而言之,它允许您创建在整个群集中分片的集合,这些集合基本上可以满足您的要求。

The process is very straight forward 这个过程非常简单

  1. Setup an ArangoDB Cluster (which I believe you already know how) 设置一个ArangoDB集群(我相信您已经知道如何)
  2. Disable Replication or set it to a factor of 1 禁用复制或将其设置为1
  3. Create a Sharded collection (a simple tutorial can be found in the link above) 创建分片集合(可以在上面的链接中找到一个简单的教程)

Moreover, I highly advise that you have a read from the Arango Learning Center for Clusters - this will help you alot in the long run. 此外,我强烈建议您阅读Arango群集学习中心的内容-从长远来看,这将对您有很大帮助。

https://www.arangodb.com/arangodb-training-center/operations/ https://www.arangodb.com/arangodb-training-center/operations/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM