简体   繁体   English

ElasticSearch将索引分配给服务器

[英]ElasticSearch Assign Index to Server

I have 4 servers running ES where each server has 1 index with 1 shard and 0 replicas: 我有4台运行ES的服务器,其中每台服务器都有1个索引,1个分片和0个副本:

Server1: Name Server
Server2: Address Server
Server3: Health Chart Server
Server4: HealthID/SSN Server

I am clustering these servers in the cloud using this SO answer disabling multicast and placing all 4 server IP's in the unicast hosts array with port 9300 works for me (on each servers config yml). 我使用此SO答案将这些服务器群集在云中,从而禁用多播,并将所有4个服务器IP放置在端口9300的单播主机阵列中(对每个服务器config yml而言)。

My question is how do I set up each index to reside on its respected server (and ONLY on that Server)? 我的问题是如何设置每个索引以驻留在其受尊重的服务器上(并且仅在该服务器上)? I index on each server via localhost and cannot have fault tolerance, nor do I need it. 我通过本地主机在每个服务器上建立索引,并且不能具有容错能力,也不需要它。 I want to cluster these servers to use an alias where I can search across all of them (that are running). 我想将这些服务器群集起来以使用别名,以便在其中搜索所有(正在运行的)服务器。 If a server goes down, then so does its index. 如果服务器故障,则其索引也会下降。 So be it -- I cannot search across it, that's fine, but I don't want the index routing to another server in the cluster, I just want it to be down. 就是这样-我无法在其上进行搜索,这很好,但是我不希望索引路由到群集中的另一台服务器,我只是希望它关闭。 Then if I reboot the server, it rejoins the cluster and is searchable again. 然后,如果我重新启动服务器,它将重新加入群集,并且可以再次搜索。

I couldn't make out a solution based on the ES Guide which is likely oversight by me, but cannot find much on how to implement this design. 我无法根据ES指南提出可能由我监督的解决方案,但找不到有关如何实现此设计的很多信息。

I'm curious on why you want to control where a whole index is allocated. 我很好奇为什么要控制整个索引的分配位置。 That means you don't want to have any replica (as replicas are never allocated on the same machine where the primaries are) ? 这意味着您不想拥有任何副本(因为副本永远不会在与主副本相同的计算机上分配)? Usually shards are distributed in an even manner, thus you shouldn't need to control allocation. 通常,碎片以均匀的方式分布,因此您无需控制分配。 Anyways, for advanced use cases you can assign labels to your nodes and control where the indices are allocated via index settings , have a look at shard allocation filtering . 无论如何,对于高级用例,您可以为节点分配标签并控制通过索引设置分配索引的位置,请参阅分片分配过滤

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

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