按索引文件夹备份,删除,恢复弹性搜索索引 [英] Backing up, Deleting, Restoring Elasticsearch Indexes By Index Folder

查看:243
本文介绍了按索引文件夹备份,删除,恢复弹性搜索索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大部分ElasticSearch文档讨论了通过REST API处理索引的问题 - 是否有任何理由不能简单地从磁盘移动或删除索引文件夹?

Most of the ElasticSearch documentation discusses working with the indexes through the REST API - is there any reason I can't simply move or delete index folders from the disk?

推荐答案

您可以将磁盘上的数据移动到一个点 -

You can move data around on disk, to a point -

如果Elasticsearch正在运行,则从来不是一个好主意移动或删除索引
文件夹,因为Elasticsearch不知道数据发生了什么,而
将在日志中获取各种 FileNotFoundExceptions 以及索引
,直到您手动删除它们为止。

If Elasticsearch is running, it is never a good idea to move or delete the index folders, because Elasticsearch will not know what happened to the data, and you will get all kinds of FileNotFoundExceptions in the logs as well as indices that are red until you manually delete them.

如果Elasticsearch没有运行,可以将索引文件夹移动到另一个节点(
实例,如果你永久地解除一个节点,并且需要关闭
数据),但是,如果删除或将文件夹移动到
Elasticsearch在重新启动服务时看不到的位置,那么弹性搜索
将不满意。这是因为Elasticsearch将所谓的
群集状态写入磁盘,而在此群集状态下,索引将被记录,因此如果
ES启动并且希望找到索引foo,但是删除foo
索引目录,索引将保持红色状态,直到通过
的REST API删除。

If Elasticsearch is not running, you can move index folders to another node (for instance, if you were decomissioning a node permanently and needed to get the data off), however, if the delete or move the folder to a place where Elasticsearch cannot see it when the service is restarted, then Elasticsearch will be unhappy. This is because Elasticsearch writes what is known as the cluster state to disk, and in this cluster state the indices are recorded, so if ES starts up and expects to find index "foo", but you have deleted the "foo" index directory, the index will stay in a red state until it is deleted through the REST API.

因为这个,我建议,如果你想从磁盘移动或删除单个
索引文件夹,那么尽可能使用REST API,因为它是
可能会使ES进入不快乐的状态,如果你删除文件夹,它期望
找到一个索引。

Because of this, I would recommend that if you want to move or delete individual index folders from disk, that you use the REST API whenever possible, as it's possible to get ES into an unhappy state if you delete a folder that it expects to find an index in.

编辑:我应该提到,可以复制(备份)索引文件夹
从Elasticsearch的角度来看,因为它不会修改
的内容。有时候,这样做可以在快照之外执行备份
&恢复API。

I should mention that it's safe to copy (for backups) an indices folder, from the perspective of Elasticsearch, because it doesn't modify the contents of the folder. Sometimes people do this to perform backups outside of the snapshot & restore API.

这篇关于按索引文件夹备份,删除,恢复弹性搜索索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆