简体   繁体   English

如何将某些索引限制为Elasticsearch集群中的一组计算机

[英]How to restrict certain indices to a set of machines in an Elasticsearch cluster

We have 2x64GB machines and 2x16GB machines in a cluster and we are creating one index per day. 群集中有2x64GB的计算机和2x16GB的计算机,我们每天创建一个索引。 The requirement is to move the new index to the 64 GB machines and the old ones to the 16GB machines. 要求是将新索引移至64 GB计算机,将旧索引移至16 GB计算机。 How can this be done with elasticsearch? 如何使用Elasticsearch完成?

You need to "tag" your nodes and specify which is which by using a node.tag property: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/index-modules-allocation.html#shard-allocation-filtering . 您需要使用node.tag属性来“标记”节点并指定哪个节点: http : node.tag -allocation-filtering

And you specify node.tag: large1 and node.tag: large2 for each 64GB nodes (one for each). 然后为每个64GB节点(每个一个)指定node.tag: large1node.tag: large2

Then, when you create your index you specify how you want it to be allocated by using "index.routing.allocation.include.tag" : "large1,large2" (these are the 64GB nodes). 然后,在创建索引时,您可以使用"index.routing.allocation.include.tag" : "large1,large2" (这些是64GB节点)来指定分配索引的方式。 When you decide to move the index from two nodes to the other two nodes, then you update the property above and specify "small1,small2" for example (smaller 16GB nodes). 当您决定将索引从两个节点移动到其他两个节点时,则更新上面的属性并指定"small1,small2" (例如,较小的16GB节点)。

I would suggest having a look at Curator , as well, that can help you change these settings. 我建议您也看一下Curator ,它可以帮助您更改这些设置。

This is a 2 step process 这是一个两步过程

  1. Tag your node with key value pairs. 用键值对标记您的节点。 For eg: , for lesser machines tag them as boxType:small and for better machine tag them as boxType:big. 例如:,对于较少的机器,将其标记为boxType:small,对于更好的机器,将其标记为boxType:big。
  2. Next apply the index filter rule using the settings API as below - 接下来,使用以下设置API应用索引过滤器规则 -
  curl -XPUT localhost:9200/index-name/_settings -d '{ "index.routing.allocation.include.tag" : "big" }' 

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

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