elasticsearch - Windows上的ElasticSearch备份,Linux上的Restore

标签 elasticsearch restore

我正在尝试在Windows上的ElasticSearch 6.2.2中备份索引并在Linux上的ElasticSearch 6.2.3上还原它。我正在执行以下步骤,但是在Linux机器(基于https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html)上却看不到快照:

在Windows上注册快照存储库

PUT /_snapshot/my_backup
{
   "type": "fs",
   "settings": {
      "location": "C:\\EsBackup",
      "compress": true
  }
}

在Windows上创建快照
PUT /_snapshot/my_backup/bcp?wait_for_completion=true
{
"indices":"myindex"
}

检查快照是否已创建
GET /_snapshot/my_backup/bcp

显示成功
{
  "snapshots": [
    {
      "snapshot": "bcp",
      "uuid": "xGLvw4JnRqadcyg4fxH1HA",
      "version_id": 6020299,
      "version": "6.2.2",
      "indices": [
        "bcp"
      ],
      "include_global_state": true,
      "state": "SUCCESS",
      "start_time": "2018-05-10T16:48:22.970Z",
      "start_time_in_millis": 1525970902970,
      "end_time": "2018-05-10T16:48:36.816Z",
      "end_time_in_millis": 1525970916816,
      "duration_in_millis": 13846,
      "failures": [],
      "shards": {
        "total": 3,
        "failed": 0,
        "successful": 3
      }
    }
  ]
}

我将文件复制到linux,并检查文件的大小和数量是否相同。 (大约200个文件,大小为500MB)。我将所有内容复制到文件夹~/elasticsearch-6.2.3/backup
初始化存储库
curl -X PUT "localhost:9200/_snapshot/my_backup" -H 'Content-Type: application/json' -d'{"type": "fs","settings": {"location": "~/elasticsearch-6.2.3/backup","compress": true}}'

并得到确认:{"acknowledged":true}
所以我检查哪些快照可用
curl -X GET "localhost:9200/_snapshot/my_backup/_status"

但列表为空{"snapshots":[]}
并还原
curl -X POST "localhost:9200/_snapshot/my_backup/bcp/_restore?pretty"

返回错误
{
  "error" : {
    "root_cause" : [
      {
        "type" : "snapshot_restore_exception",
        "reason" : "[my_backup:bcp] snapshot does not exist"
      }
    ],
    "type" : "snapshot_restore_exception",
    "reason" : "[my_backup:bcp] snapshot does not exist"
  },
  "status" : 500
}

我想走哪一步?我试图_verify存储库,它是有效的。版本6.2.2和6.2.3应该兼容。

最佳答案

elasticsearch.yml文件中添加以下内容:

path.repo: /path/to/repo

关于elasticsearch - Windows上的ElasticSearch备份,Linux上的Restore,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50278255/

相关文章:

elasticsearch - 如何打开控制台/窗口以在 Elasticsearch 中使用CURL命令?

Java WebApp 配置备份和恢复

version-control - 如何备份 Plastic SCM 中的存储库?

elasticsearch - 显示和更改参数 threadpool.bulk.queue_size

ElasticSearch 短语建议器随机返回 0 个结果

mysql - 操纵巨大的 MySQL 转储文件

hadoop - <问> 如何备份和恢复HDFS

python - Google App Engine - 非常慢且昂贵的备份和恢复?

python - 为什么 Haystack AutoQuery 被调用两次?

elasticsearch - 使用 Elasticsearch 的独特字段组合的最新结果