Elasticsearch对shard分配定制

释放双眼,带上耳机,听听看~!

       Elasticsearch会自动的控制shard在各个节点的分配,同时也提供了配置方法
,允许用户根据自己的特定需求对shard的分配策略进行一定的定制。
其中,
index-modules-allocation 介绍了如下几种在索引级别(index-level)的配置:

  • shard allocation filtering (index-/cluster-level)
  • total shard per node
  • disk-based shard allocation

例如, Elasticsearch也可以通过allocation.exclude/include设置来指定索引的shard不可以分配到哪些节点上/只能分配到哪些节点上。其中,'AvailabilitySet'是在.yml文件中定义的, 如:node.AvailabilitySet: "master":

PUT /*/_settings
{
"index.routing.allocation.exclude.AvailabilitySet" : "data-events"
}

PUT /*/_settings
{
"index.routing.allocation.include.AvailabilitySet" : "data-events"
}

同时, 在cluster shards allocation 中介绍了集群级别(cluster-level)的基于shard allocation awareness的分配配置。除了自动分配策略定制决定shard分配外,Elasticsearch也提供了专门的 reroute API 用于手工进行shard的移动、分配以及取消指令, 例如 :

POST /_cluster/reroute
{
"commands": [
{
"move": {
"index": "logindex",
"shard": 0,
"from_node": "ES5-001-data",
"to_node": "ES6-03-data"
}
}
]
}

POST /_cluster/reroute
{
"commands": [
{
"allocate": {
"index": "logindex", "shard": 0, "node": "ES5-001-data"
}
}
]
}







给TA打赏
共{{data.count}}人
人已打赏
安全运维

OpenSSH-8.7p1离线升级修复安全漏洞

2021-10-23 10:13:25

安全运维

设计模式的设计原则

2021-12-12 17:36:11

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索