# Trying to restore snapshot

**URL:** <https://discuss.elastic.co/t/trying-to-restore-snapshot/293448>\
**Category:** Elasticsearch\
**Tags:** docker, snapshot-and-restore\
**Created:** [January 4, 2022, 1:42pm UTC](https://discuss.elastic.co/t/trying-to-restore-snapshot/293448 "2022-01-04T13:42:49Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![fribse](https://avatars.discourse-cdn.com/v4/letter/f/c67d28/32.png) [@fribse](https://discuss.elastic.co/u/fribse)\
**Post date:** [January 4, 2022, 1:42pm UTC](https://discuss.elastic.co/t/trying-to-restore-snapshot/293448/1 "2022-01-04T13:42:49Z")

</div>

So I've been running my Elasticsearch in docker-compose.  
Now I have by accident lost all my data 😢, it's not so much the data itself as that is only historic, but rather all the kibana work made.  
I'm now trying to restore a snapshot I had.  
If I send a 'GET \_snapshot' I get an empty list {}.  
But if I look inside the container in opt/Elasticsearch/backup I see the snapshot which is store in the hostfilesystem.  
So I'm hoping I can get Elasticsearch to discover the snapshot and do a restore, and that the snapshot is new enough for the 7.16.2 to understand it.  
Anybody that has some help for me on this?

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [January 4, 2022, 2:04pm UTC](https://discuss.elastic.co/t/trying-to-restore-snapshot/293448/2 "2022-01-04T14:04:37Z")

</div>

What version are you running? In which version was the snapshot created?

Since you had a filesystem snapshot, you should have a `path.repo` line in your `elasticsearch.yml` pointing to that same path, please share your `elastiscearch.yml`.

You can try to register this path as a snapshot and check if Elasticsearch can read that, follow the [documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/snapshots-register-repository.html#snapshots-filesystem-repository) on how to register a filesystem repository.

---

<div class="post-metadata">

**Author:** ![fribse](https://avatars.discourse-cdn.com/v4/letter/f/c67d28/32.png) [@fribse](https://discuss.elastic.co/u/fribse)\
**Post date:** [January 4, 2022, 2:50pm UTC](https://discuss.elastic.co/t/trying-to-restore-snapshot/293448/3 "2022-01-04T14:50:36Z")

</div>

The whole operation was to get it to 7.16.2 (log4j), so that is what the cluster is running now.  
The backup was done on a 6.5.11 (if I recall correctly), it was moved to 6.8.22 but no snapshot was done there.

The settings for the Elasticsearch looks like this:

```auto
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.16.2
    container_name: es01
    environment:
      - node.name=es01
      - cluster.name=docker-cluster
      - discovery.seed_hosts=elasticsearch2,elasticsearch3
      - cluster.initial_master_nodes=es01,es02,es03
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms28g -Xmx28g"
      - 'path.repo=/opt/elasticsearch/backup'
      - xpack.security.enabled=true
      - xpack.security.http.ssl.enabled=true
      - xpack.security.http.ssl.key=$CERTS_DIR/es01/es01.key
      - xpack.security.http.ssl.certificate_authorities=$CERTS_DIR/ca/ca.crt
      - xpack.security.http.ssl.certificate=$CERTS_DIR/es01/es01.crt
      - xpack.security.transport.ssl.enabled=true
      - xpack.security.transport.ssl.verification_mode=certificate
      - xpack.security.transport.ssl.certificate_authorities=$CERTS_DIR/ca/ca.crt
      - xpack.security.transport.ssl.certificate=$CERTS_DIR/es01/es01.crt
      - xpack.security.transport.ssl.key=$CERTS_DIR/es01/es01.key
# DO NOT GO ABOVE 31 GB, as that will move it to 64 bits, which is not recommended"
    ulimits:
      nproc: 65535
      memlock:
        soft: -1
        hard: -1
    cap_add:
      - ALL
    privileged: true
    volumes:
      - esdata1:/usr/share/elasticsearch/data
      - /docker/elastic-backup1:/opt/elasticsearch/backup
      - certs:$CERTS_DIR
    ports:
      - 9201:9200
      - 9300:9300
    restart: always

```

So currently no path.repo is set up here. I will try to set up the path through requests.

---

<div class="post-metadata">

**Author:** ![fribse](https://avatars.discourse-cdn.com/v4/letter/f/c67d28/32.png) [@fribse](https://discuss.elastic.co/u/fribse)\
**Post date:** [January 4, 2022, 3:14pm UTC](https://discuss.elastic.co/t/trying-to-restore-snapshot/293448/4 "2022-01-04T15:14:54Z")

</div>

Ok, so I did a PUT /\_snapshot/backup with

```auto

{
  "type": "fs",
  "settings": {
    "location": "/opt/elasticsearch/backup",
    "compress": true
  }
}

```

And after doing that I did a GET \_snapshot and I got

{"backup":{"type":"fs","settings":{"compress":"true","location":"/opt/Elasticsearch/backup"}}}

So that looks good, now I just need to find out if I can restore it...

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [January 4, 2022, 3:42pm UTC](https://discuss.elastic.co/t/trying-to-restore-snapshot/293448/5 "2022-01-04T15:42:45Z")

</div>

You should use [cat snapshots](https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-snapshots.html#cat-snapshots) to see if Elasticsearch will detect any snapshots in that path.

Try: `GET _cat/snapshots/backup` or `GET _cat/snapshots`

---

<div class="post-metadata">

**Author:** ![fribse](https://avatars.discourse-cdn.com/v4/letter/f/c67d28/32.png) [@fribse](https://discuss.elastic.co/u/fribse)\
**Post date:** [January 5, 2022, 8:10am UTC](https://discuss.elastic.co/t/trying-to-restore-snapshot/293448/6 "2022-01-05T08:10:31Z")

</div>

Hi Leandro  
Thankyou very very much for helping me out here.

Darned, either of them returns an empty string.  
Odd thing is, I tried doing the 'PUT /\_snapshot/backup' while only having copied files back for the first node, and then it complained that the backup was incomplete, after copying data back for all nodes it didn't complain.  
Is that because the snapshot is too old for 7.16.2?

---

<div class="post-metadata">

**Author:** ![fribse](https://avatars.discourse-cdn.com/v4/letter/f/c67d28/32.png) [@fribse](https://discuss.elastic.co/u/fribse)\
**Post date:** [January 5, 2022, 8:27am UTC](https://discuss.elastic.co/t/trying-to-restore-snapshot/293448/7 "2022-01-05T08:27:02Z")

</div>

I tried starting the cluster up with 6.8.22, and do a  
PUT /\_snapshot/backup

```auto
{
  "type": "fs",
  "settings": {
    "location": "/opt/elasticsearch/backup",
    "compress": true
  }
}

```

Like before, I did that on all three nodes.  
If I do a GET /\_cat/snapshots  
I get this message:

```auto
{
  "error": {
    "root_cause": [{
      "type": "action_request_validation_exception",
      "reason": "Validation Failed: 1: repository is missing;"
    }],
    "type": "action_request_validation_exception",
    "reason": "Validation Failed: 1: repository is missing;"
  },
  "status": 400
}

```

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [January 5, 2022, 2:57pm UTC](https://discuss.elastic.co/t/trying-to-restore-snapshot/293448/8 "2022-01-05T14:57:50Z")

</div>

A snapshot made in version 6 is compatible with a version 7 cluster, so, if you have a snapshot in that path, a cluster in version 7 would be able to read it.

Also, since you are use a filesystem repository, the `path.repo` should be in every node and the mount point should be the same for every node.

You need to do the following steps to check if there is a repository in that path.

1. Add the `path.repo` in all the nodes and mount the same mount point on them.
2. Register the snapshot
3. Use `GET _cat/snapshots/backup`, supposing that backup was the name you used for the snapshot while registering.

If the GET request returns nothing, them Elasticsearch didn't find any snapshot in that path.

---

<div class="post-metadata">

**Author:** ![fribse](https://avatars.discourse-cdn.com/v4/letter/f/c67d28/32.png) [@fribse](https://discuss.elastic.co/u/fribse)\
**Post date:** [January 6, 2022, 1:09am UTC](https://discuss.elastic.co/t/trying-to-restore-snapshot/293448/9 "2022-01-06T01:09:07Z")

</div>

I there a way I can see the name of it in the files?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 3, 2022, 1:09am UTC](https://discuss.elastic.co/t/trying-to-restore-snapshot/293448/10 "2022-02-03T01:09:56Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
