简体   繁体   中英

Elasticsearch respository shows no snapshots after upgrade from 2.x to 5.x

On a RHEL6 system, I followed the steps laid out here to create a repository and capture a snapshot prior to my upgrade. I verified the existence of the snap shot:

curl 'localhost:9200/_snapshot/_all?pretty=true'

Which gave me the following result:

{ "upgrade_backup" : {
"type" : "fs",
"settings" : {
"compress" : "true",
"location" : "/tmp/elasticsearch-backup"
} } }

After upgrading Elasticsearch via yum, I went to restore my snapshot but none are showing up:

curl 'localhost:9200/_snapshot/_all?pretty=true'

{ }

I checked on the file system and see the repository files:

ls -lrt /tmp/elasticsearch-backup

total 24
-rw-r--r--. 1 elasticsearch elasticsearch 121 Apr 7 14:42 meta-snapshot-number-one.dat
drwxr-xr-x. 3 elasticsearch elasticsearch 21 Apr 7 14:42 indices
-rw-r--r--. 1 elasticsearch elasticsearch 191 Apr 7 14:42 snap-snapshot-number-one.dat
-rw-r--r--. 1 elasticsearch elasticsearch 37 Apr 7 14:42 index
-rw-r--r--. 1 elasticsearch elasticsearch 188 Apr 7 14:51 index-0
-rw-r--r--. 1 elasticsearch elasticsearch 8 Apr 7 14:51 index.latest
-rw-r--r--. 1 elasticsearch elasticsearch 29 Apr 7 14:51 incompatible-snapshots

I made sure elasticsearch.yml still has the "data.repo" tag, so I'm not sure where to look or what to do to determine what happened, but somehow my snapshots vanished!

You need to add following line to elasticsearch.yml :

path.repo: ["/tmp/elasticsearch-backup"]

Then restart Elastic service and create a new snapshots repository:

curl -XPUT "http://localhost:92000/_snapshot/backup" -H 'Content-Type: application/json' -d '{
    "type": "fs",
    "settings": {
        "location": "/tmp/elasticsearch-backup",
        "compress": true
    }
}'

Now you should be able to list all snapshots in your repository and eventually restore them:

curl -s -XGET "localhost:9200/_snapshot/backup/_all" | jq .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM