ElasticSearch快照/备份不起作用

时间:2016-04-08 08:52:29

标签: elasticsearch backup snapshot

我的ES快照不起作用或看起来是空的。

首先,我在我的Ubuntu服务器上完成了这个:

1.创建备份目录

mkdir /home/admin/dumps/elasticsearch

2.将此目录设置为elastissearch.yml for snapshots

path.repo: ["/home/admin/dumps/elasticsearch"]

3.设置快照存储库位置

curl -XPUT 'http://localhost:9200/_snapshot/backup' -d '{
  "type": "fs",
  "settings": {
    "location": "/home/admin/dumps/elasticsearch",
    "compress": true
  }
}'

然后,我可以运行快照:

curl -XPUT localhost:9200/_snapshot/backup/elasticsearch_snapshot?wait_for_completion=true

响应:

  

{ “快照”:{ “快照”: “elasticsearch_snapshot”, “VERSION_ID”:2030099, “版本”: “2.3.0”, “指数”:[ “引用”], “状态”: “SUCCESS” “START_TIME”: “2016-04-08T08:45:30.525Z”, “start_time_in_millis”:1460105130525 “END_TIME”: “2016-04-08T08:45:30.779Z”, “end_time_in_millis”:1460105130779, “duration_in_millis” :254, “失败”:[], “碎片”:{ “总”:15, “故障”:0, “成功”:15}}}

我还创建了一个cronjob来每天5:35备份ElasticSearch:

35 5 * * * curl -X PUT "localhost:9200/_snapshot/backup/elasticsearch.$(date +\%Y-\%m-\%d)?wait_for_completion=true"

好吧,当我转到我的dumps / elasticsearch文件夹时,我明白了:

  

-rw-r - r-- 1 elasticsearch elasticsearch 256 Apr 8 10:45 index drwxr-xr-x 5 elasticsearch elasticsearch 4096 Apr 8 05:35 indices   -rw-r - r-- 1 elasticsearch elasticsearch 121 Apr 1 05:35 meta-elasticsearch.2016-04-01.dat   -rw-r - r-- 1 elasticsearch elasticsearch 121 Apr 2 05:35 meta-elasticsearch.2016-04-02.dat   -rw-r - r-- 1 elasticsearch elasticsearch 121 Apr 3 05:35 meta-elasticsearch.2016-04-03.dat   -rw-r - r-- 1 elasticsearch elasticsearch 121 Apr 4 05:35 meta-elasticsearch.2016-04-04.dat   -rw-r - r-- 1 elasticsearch elasticsearch 121 Apr 5 05:35 meta-elasticsearch.2016-04-05.dat   -rw-r - r-- 1 elasticsearch elasticsearch 121 Apr 6 05:35 meta-elasticsearch.2016-04-06.dat   -rw-r - r-- 1 elasticsearch elasticsearch 121 Apr 7 05:35 meta-elasticsearch.2016-04-07.dat   -rw-r - r-- 1 elasticsearch elasticsearch 121 Apr 8 05:35 meta-elasticsearch.2016-04-08.dat   -rw-r - r-- 1 elasticsearch elasticsearch 213 Apr 1 05:35 snap-elasticsearch.2016-04-01.dat   -rw-r - r-- 1 elasticsearch elasticsearch 213 Apr 2 05:35 snap-elasticsearch.2016-04-02.dat   -rw-r - r-- 1 elasticsearch elasticsearch 213 Apr 3 05:35 snap-elasticsearch.2016-04-03.dat   -rw-r - r-- 1 elasticsearch elasticsearch 212 Apr 4 05:35 snap-elasticsearch.2016-04-04.dat   -rw-r - r-- 1 elasticsearch elasticsearch 213 Apr 5 05:35 snap-elasticsearch.2016-04-05.dat   -rw-r - r-- 1 elasticsearch elasticsearch 213 Apr 6 05:35 snap-elasticsearch.2016-04-06.dat   -rw-r - r-- 1 elasticsearch elasticsearch 213 Apr 7 05:35 snap-elasticsearch.2016-04-07.dat   -rw-r - r-- 1 elasticsearch elasticsearch 217 Apr 8 05:35 snap-elasticsearch.2016-04-08.dat

Cron快照在那里,但所有数据似乎都是空的! 我错过了什么?

1 个答案:

答案 0 :(得分:0)

在Elasticsearch快照中,仅快照的元数据存储在根级别路径中。 所有索引备份的实际数据都存储在根路径的/indices文件夹下。

如果您查看/indices文件夹中的内容,则会看到群集数据