简体   繁体   English

Elasticsearch索引复制到新服务器

[英]Elasticsearch index replication to new server

I am very new to Elasticsearch and I have a architectural question. 我是Elasticsearch的新手,我有一个架构问题。 I have a system where I store bouch of documents. 我有一个存储文件袋的系统。 Some of these documents are PUBLIC some of them are Private. 其中一些文件是PUBLIC,其中一些是私人文件。

In the main system the documents are entered, indexed and searched. 在主系统中,文档被输入,索引和搜索。 This is so far very easy to implement. 到目前为止,这非常容易实现。

Although here is an additional requirement. 尽管这是一个附加要求。

  • I need to create a slave system which is a replication of the primary main ES instance although it can not contain any private document not even in the index level. 我需要创建一个从属系统,该系统是主主要ES实例的复制,尽管它甚至不能包含索引级别的任何私有文档。 So it is not enough for me to make sure I search for the right documents with a filter but the index can not contain the document which are marked private 因此,对于我来说,确保我用过滤器搜索正确的文档还不够,但是索引不能包含标记为私有的文档

I was wondering if I could do the following -> 我想知道我是否可以执行以下操作->

1, Clone the primary ES instance 2, Delete all documents which are private 3, Re-index the whole index 4, Create a snapshot of the clean ES 5, Restore this snapshot to the Slave Public instance. 1,克隆主ES实例2,删除所有私有文档3,重新索引整个索引4,创建干净ES的快照5,将此快照还原到Slave Public实例。

This sounds very complicated to me. 这对我来说听起来很复杂。 is there a better / easier way to do this ? 有没有更好/更容易的方法来做到这一点?

Thanks a lot for any pointer in advance, 非常感谢您提前提出任何建议,

I'd suggest this approach as an alternative. 我建议将此方法作为替代方法。 Create two indexes, Public and Private, on your main Elasticsearch cluster. 在主Elasticsearch集群上创建两个索引,即Public和Private。 Also create an index alias http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-aliases.html that covers both so that you have a convenient way to query both indexes at once. 还要创建一个索引别名http://www.elasticsearch.org/guide/zh-CN/elasticsearch/reference/current/indices-aliases.html ,其中包含这两个别名,因此您可以方便地一次查询两个索引。

You can then use the Elasticsearch snapshot and restore http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-snapshots.html to take a snapshot of just the Public index and restore it to another cluster. 然后,您可以使用Elasticsearch快照并将http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-snapshots.html还原为仅公共索引的快照并将其还原到另一个集群。

This way you have another ES cluster with only the Public index in it. 这样,您将拥有另一个仅包含Public索引的ES集群。

Another approach would be to keep each index, Public and Private, in it's own cluster. 另一种方法是将每个索引(公共索引和私有索引)都保留在其自己的集群中。 When you want to run a query across both Public and Private use a tribe node. 当您想同时在“公共”和“私人”之间运行查询时,请使用部落节点。 A tribe node will connect to both clusters and run the query across both of them: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-tribe.html 一个部落节点将连接到两个集群,并在两个集群上运行查询: http : //www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-tribe.html

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

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