美文网首页
索引分片策略

索引分片策略

作者: 西二旗老司机 | 来源:发表于2019-07-11 19:40 被阅读0次

Total shards per node

The cluster-level shard allocator tries to spread the shards of a single index across as many nodes as possible. However, depending on how many shards and indices you have, and how big they are, it may not always be possible to spread shards evenly.

The following dynamic setting allows you to specify a hard limit on the total number of shards from a single index allowed per node:

index.routing.allocation.total_shards_per_node
The maximum number of shards (replicas and primaries) that will be allocated to a single node. Defaults to unbounded.
You can also limit the amount of shards a node can have regardless of the index:

cluster.routing.allocation.total_shards_per_node
The maximum number of shards (replicas and primaries) that will be allocated to a single node globally. Defaults to unbounded (-1).

index.routing.allocation.total_shards_per_node 这个参数可以控制单个索引在同一个结点上最多分配几个shard。 默认是无上限,因此在扩容新结点的时候,很可能一个索引的很多shard分到同一个node。 具体设置多少,需要根据集群结点数量和一个index shard总数量(包含主和副复制片)来定。

例如10个node,index设置 5 primary + 5 replica。
设置index.routing.allocation.total_shards_per_node:1 可以保证这个索引在每个node上只分配一个shard。 这样设置好处是数据分布最均匀, 但是也有负面影响,比如如果有一个node挂了,就会有一个shard无法分配,变成UNASSIGNED状态。
如果设置index.routing.allocation.total_shards_per_node:2 ,则可能数据均衡状态不如设置为1那么理想,但是可以容忍一个node挂掉,因为shard可以再分配到其他node。 这个设置结合shard balancing heuristics做全局调配应该比较理想。

相关文章

  • ElasticSearch-索引原理

    索引分片 索引分片-水平扩展: 索引分片-应对故障: 数据路由 路由策略: 1、 路由公式:shard = has...

  • 索引分片策略

    Total shards per node The cluster-level shard allocator t...

  • 搜索引擎ElasticSearch之(2)、索引管理

    1、索引管理 1.1、索引创建 创建索引主要设置主分片及副分片数量。索引创建后,主分片数不能更改,可以修改副本分片...

  • ShardingSphere官网及总结

    中文文档 分片 分片算法 精确分片算法 范围分片算法 复合分片算法 Hint分片算法 分片策略 标准分片策略 复合...

  • 【mongoDB】mongoDB分片策略

    chunk切分是根据分片策略进行实施的,分片策略的内容包括分片键和分片算法。 当前,MongoDB支持两种分片算法...

  • shardindjdbc-hint策略

    HintShardingStrategy不需要分片键的强制分片策略。这个分片策略,简单来理解就是说,他的分片键不再...

  • sharding-jdbc分片策略

    分片维度 Sharding-JDBC中的分片策略有两个维度,分别是:数据源分片策略(DatabaseShardin...

  • shardindjdbc-range策略

    StandardShardingStrategy策略只支持单分片键的标准分片策略。配置参数:standard.sh...

  • Elasticsearch性能优化

    索引层面优化 分片大小 分片大小对于搜索查询非常重要 如果分配给索引的分配太多分片,会导致lucene分段很小.从...

  • 日知录1-数据分片模型和路由算法

    分片模型: 先将数据映射到分片;再将分片映射到机器;都是多对一的关系。 分片策略:哈希分片和范围分片。 哈希分片通...

网友评论

      本文标题:索引分片策略

      本文链接:https://www.haomeiwen.com/subject/obucoqtx.html