1
votes

I'm trying to backup an index in ElasticSearch 6.2.2 on Windows and restore it on ElasticSearch 6.2.3 on linux. I'm taking following steps but I never see the snapshots on the linux machine (based on https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html):

Register a snapshot repository on Windows

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

Create a snapshot on Windows

PUT /_snapshot/my_backup/bcp?wait_for_completion=true
{
"indices":"myindex"
}

Check that snapshot is created

GET /_snapshot/my_backup/bcp

It shows success

{
  "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
      }
    }
  ]
}

I copy the files to linux and check that size and number of files is the same. (It's around 200 files with size of 500MB). I copy everything to a folder ~/elasticsearch-6.2.3/backup

Initialize the repository

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}}'

And got acknowledgement: {"acknowledged":true}

So I check which snapshots are available

curl -X GET "localhost:9200/_snapshot/my_backup/_status"

But the list is empty {"snapshots":[]}

And restore

curl -X POST "localhost:9200/_snapshot/my_backup/bcp/_restore?pretty"

returns an error

{
  "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
}

What step am I missing? I tried to _verify the repository and it's valid. Version 6.2.2 and 6.2.3 should be compatible.

2

2 Answers

1
votes

Add the following in elasticsearch.yml file:

path.repo: /path/to/repo
0
votes

I'm not sure why, but the home path cannot use ~, but if stated as "/home/user/elasticsearch-6.2.3/backup" then it works