我们想设置 4 个节点的集群来托管数据。并且集群仅托管一个索引,因此在所有 4 个节点中具有相似的数据类型。
我们的目标是将数据分片到节点上。假设两个分片和两个副本。 (总共 4 个节点来托管这 4 个数据分区)
文档模式是“索引”,全局是“真”。
<redundancy>2</redundancy>
<nodes>
<node hostalias="node1" distribution-key="0"/>
<node hostalias="node2" distribution-key="1"/>
<node hostalias="node3" distribution-key="2"/>
<node hostalias="node4" distribution-key="3"/>
</nodes>
<engine>
<proton>
<searchable-copies>2</searchable-copies>
<flush-on-shutdown>true</flush-on-shutdown>
</proton>
</engine>
在 services.xml 中的上述配置是 不允许 .它要求冗余至少与节点数相同,我们需要配置,
<redundancy>4</redundancy>
和
<searchable-copies>4</searchable-copies>
使其接受有效的配置。
这就是将所有 4 个节点配置为拥有所有数据,每个节点都将包含数据副本。根据http://docs.vespa.ai/documentation/content/data-placement.html - 我们需要 global=true。并注意到:
Note: The global documents feature is under development. It is currently only available for setups where all documents are already inherently on all nodes, i.e. N groups each containing a single node.
如何在分片中分配数据?我们可以让节点 1 和节点 2 拥有分布式数据,节点 3 和节点 4 可以拥有冗余 2 的副本吗?
最佳答案
感谢您的提问 - 我看到 global=true 的文档有点令人困惑。
在您的情况下,您想要分片,即在 4 个节点上分发每个文档的 2 个副本(如果我错了,请纠正我)。
global 通常用于父文档,如 http://docs.vespa.ai/documentation/search-definitions.html#document-references - 在您的情况下,您只有文档类型(我假设),因此没有 parent ,所以不要使用全局
全局功能将在 4 个节点上分发 4 个副本(如果这是您想要的,请设置冗余=4)。但也不需要在这里使用 global 。
关于vespa - 如何在 Vespa 中配置分片?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46946739/