简体   繁体   English

跨集群的 ElasticSearch 快照

[英]ElasticSearch Snapshot across cluster

Recently I created a snapshot of an index in an elasticsearch cluster consisting of 3 data nodes.最近我在一个由 3 个数据节点组成的elasticsearch集群中创建了一个索引的snapshot

My main purpose is to move this index in another cluster.我的主要目的是将此索引移动到另一个集群中。

Commands I used:我使用的命令:

PUT /_snapshot/my_backup

{
    "type": "fs",
    "settings": {
        "location": "/home/me/backup",
        "compress": true
    }
}


PUT _snapshot/my_backup/snapshot_1?wait_for_completion=true
{
  "indices": "daily-20141127"
}

Note: Above queries were executed in the same data node.注意:以上查询是在同一个数据节点中执行的。

Snapshot was successfully created in the above location but in another node from where I hit the queries and each node in this backup location had a folder(name:indices) which contained the shards of backup index on equivalent node. Snapshot已在上述位置成功创建,但在我执行查询的另一个节点中,此备份位置中的每个节点都有一个文件夹(名称:索引),其中包含等效节点上的备份索引分片。

Example:例子:
node1: home/me/my_backup/indices/1,2,3节点 1:家/我/my_backup/indices/1,2,3
node2: home/me/my_backup/indices/4,5,6 node2:家/我/my_backup/indices/4,5,6
node3: home/me/my_backup/indices/7,8,9 node3:家/我/my_backup/indices/7,8,9

So I had to manually copy all indices folders across cluster to the node which had the metadata of snapshot to complete backup.因此,我必须手动将集群中的所有索引文件夹复制到具有快照元数据的节点以完成备份。 I then copied backup folder to new cluster and restored it(restore procedure was fine)然后我将备份文件夹复制到新集群并恢复它(恢复过程很好)

Can all indices folders of backup index be in 1 node instead of being split across cluster?备份索引的所有索引文件夹都可以在 1 个节点中而不是跨集群拆分吗?

The location you are specifying should be a "shared" location and the path specified in the repository should point to the same directory shared across all nodes.您指定的location应为“共享”位置,并且存储库中指定的路径应指向所有节点共享的同一目录。 It cannot be just a local directory on the node.它不能只是节点上的本地目录。 For example: that location can be a network-shared mount on a separate machine and all nodes should point to it and should be able to access it.例如:该位置可以是单独机器上的网络共享安装,所有节点都应该指向它并且应该能够访问它。

The reason for this is that each node may hold a primary or a replica from a shard and it should be able to make a copy of the docs contained in that specific shard and then moved over to the "shared" location.这样做的原因是每个节点可能持有一个主分片或分片的副本,它应该能够制作包含在该特定分片中的文档的副本,然后移动到“共享”位置。

As Andrei wrote - to use snapshots over multiple nodes, you will need a shared location which can be accessed by all nodes and you have to elasticsearch.yml settings with identical path.repo entry.正如安德烈所写 - 要在多个节点上使用快照,您将需要一个可以被所有节点访问的共享位置,并且您必须使用相同的 path.repo 条目进行 elasticsearch.yml 设置。

There is a guide how to create shared repositories across multiple clusters which covers all the steps you need, including setting up Samba server and clients + configuring ElasticSearch.有一个指南如何跨多个集群创建共享存储库,其中涵盖了您需要的所有步骤,包括设置 Samba 服务器和客户端 + 配置 ElasticSearch。

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

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