Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snapshot/Restore: Add ability to restore partial snapshots #5742

Closed
geekpete opened this Issue Apr 9, 2014 · 2 comments

Comments

Projects
None yet
2 participants
@geekpete
Copy link
Member

geekpete commented Apr 9, 2014

Is there a way to copy a single index from a snapshot marked as "incomplete" by the restore function to the data dir of a single node elastic cluster in order to restore that index data by reopening it as a closed index?

eg, to restore a single index from a multi-index snapshot (an index marked as incompleted).

from whatever source location with a dir structure like:

snapshotname/indices/myindexname/*

to:

/var/lib/elasticsearch/mycluster/nodes/0/indices/myindexname/*

will elasticsearch see this as a closed index and provide the ability to online it again?

Failing that, is there any other possible way to salvage data from a snapshotted index that is marked as incomplete, especially if the size of the index appears to be correct?

@imotov

This comment has been minimized.

Copy link
Member

imotov commented Apr 10, 2014

You should be able to restore all indices that were successfully snapshotted except the incomplete index by excluding the incomplete index from the restore operation:

$ curl -XPOST "localhost:9200/_snapshot/my_backup/snapshot_1/_restore" -d '{
    "indices": "-corrupted_index",
    "include_global_state": false
}'

There is no way simple to force incomplete index to be restored at the moment. What type of failures do you see when you run the following command:

$ curl -XGET localhost:9200/_snapshot/repository_name/snapshot_name
@geekpete

This comment has been minimized.

Copy link
Member Author

geekpete commented Apr 10, 2014

I have it working. :)

You can adjust the metadata files in the snapshot to allow the restore to work.

After restoring the incomplete index, I get an incomplete/uninitialisable shard that must be replaced with a blank one from a temporary index to get the cluster back to green (as I was able to prove the data for that shard was simply missing from the snapshot.)

But an override to the usual behaviour would be nice to do the following:
-allow restoration of incomplete indexes from snapshots
-provide the ability to zero out the data in bad/incomplete shards if the data is missing to ensure green state when restored
-provide detailed feedback on the shards that have been reset to blank and how much data and how many documents were lost

I do realise that once again my case is probably an edge case so not that high priority compared to other features/bugs. :)

Thanks.

@imotov imotov self-assigned this Apr 11, 2014

@imotov imotov added bug and removed bug labels Jun 1, 2014

@imotov imotov added the v2.0.0 label Jun 1, 2014

imotov added a commit to imotov/elasticsearch that referenced this issue Jul 1, 2014

@imotov imotov closed this in #6368 Jul 1, 2014

imotov added a commit that referenced this issue Jul 1, 2014

@clintongormley clintongormley changed the title Can an incomplete snapshot be manually restored? Snapshot/Restore: Add ability to restore partial snapshots Jul 16, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.