You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a situation where I'm restoring Snapshots between two clusters using an S3 Bucket repository as a temporary storage.
The restore snapshot will fail with a security exception, even when excluding the .opendistro_security, the global state and all other private indexes.
This will fail for DATA STREAMS only, with a security exception, whenever you specify the NAME of the datastream in the indices parameter.
This does not happen if the SOURCE snapshot does only contain the data stream and nothing else, and the full snapshot is restored without using the indices key.
Related component
Storage:Snapshots
To Reproduce
Prerequisites:
Both OpenSearch have configured correct cross-account roles and have the same S3 SnapShot Repository available, if migrating. This is reproducible in the same cluster by taking snapshots and then deleting the snapshotted data streams.
NOTE: The USER used in these calls has ALL_ACCESS, MANAGE_SNAPSHOTS, SECURITY, etc etc. Full access.
On the SOURCE OpenSearch, I can add the repository, then take a full snapshot, including global state: PUT _snapshot/temp-repo/snapshot_20240918
The snapshot contains everything, both the datastreams and the .private indexes
Wait for completion, the new OpenSearch will then display the taken snapshot as completed and available.
From the full snapshot, try to restore ONLY things that you will need, eg, only a single data stream.
The data stream, nor it's backing indexes, DO NOT exist on the new cluster (2.15).
Exclude global state POST _snapshot/temp-repo/snapshot_20240918/_restore
The restore fails immediately with a security exception with NO roles required.
Additionally, EXCLUDING -.opendistro_security in indices has no effect - same Authorization error
Recovering the .ds underlying indexes work - BUT there will be no Data Stream structure created, so it will be needed to do a manual recovery.
Take a new snapshot, but this time, explicitly EXCLUDE global state and only include the data stream
This must be done WHEN TAKING THE SNAPSHOT ITSELF, including only the datastream PUT _snapshot/temp-repo/snapshot_20240920_only_data_stream
Execute the same command as in STEP 3 but without using the indices field (it will result in an Index Not Found error, or a Security Error just like the first execution) POST _snapshot/temp-repo/snapshot_20240920_only_data_stream/_restore
When restoring from a full, or partial Snapshot, specifying the name of the index pattern in the field indices should work without security issues OR index not found errors.
At the moment, only restoring the full snapshot works.
TL;DR: This SHOULD WORK FOR ANY SNAPSHOT -> but it does not: POST _snapshot/temp-repo/any-snapshot-full-or-partial/_restore
SLOW WORKAROUND FOR NOW:
If you cannot take a new partial snapshot and are stuck with a FULL snapshot, which contains special indexes that cannot be recovered without excluding them (eg: .opendistro_security), since you CANNOT use the indices fields, you can
Recover all the underlying .ds-stream-name-000001 to a _recovered status, using rename fields POST _snapshot/temp-repo/FULL_SNAPSHOT/_restore
Create a new data stream with the same name and settings of what you need to recreate [DATA-STREAM-NAME]
Do a /_reindex (you need to manage manual rollovers if you need ISM since if you reindex everything it will not apply ISM policies until the end!!) from the .ds-name-000_RECOVERED -> to the new DataStream
[Triage] @alexmaurizio Thank you for filing this issue. This looks like a bug. Transferring to security repo for comment.
cwperks
transferred this issue from opensearch-project/OpenSearch
Sep 23, 2024
cwperks
added
triaged
Issues labeled as 'Triaged' have been reviewed and are deemed actionable.
and removed
untriaged
Require the attention of the repository maintainers and may need to be prioritized
labels
Sep 23, 2024
Describe the bug
I have a situation where I'm restoring Snapshots between two clusters using an S3 Bucket repository as a temporary storage.
The restore snapshot will fail with a security exception, even when excluding the
.opendistro_security
, the global state and all other private indexes.This will fail for DATA STREAMS only, with a security exception, whenever you specify the NAME of the datastream in the
indices
parameter.This does not happen if the SOURCE snapshot does only contain the data stream and nothing else, and the full snapshot is restored without using the
indices
key.Related component
Storage:Snapshots
To Reproduce
Prerequisites:
Both OpenSearch have configured correct cross-account roles and have the same S3 SnapShot Repository available, if migrating. This is reproducible in the same cluster by taking snapshots and then deleting the snapshotted data streams.
NOTE: The USER used in these calls has ALL_ACCESS, MANAGE_SNAPSHOTS, SECURITY, etc etc. Full access.
On the SOURCE OpenSearch, I can add the repository, then take a full snapshot, including global state:
PUT _snapshot/temp-repo/snapshot_20240918
The snapshot contains everything, both the datastreams and the .private indexes
Wait for completion, the new OpenSearch will then display the taken snapshot as completed and available.
From the full snapshot, try to restore ONLY things that you will need, eg, only a single data stream.
The data stream, nor it's backing indexes, DO NOT exist on the new cluster (2.15).
Exclude global state
POST _snapshot/temp-repo/snapshot_20240918/_restore
The restore fails immediately with a security exception with NO roles required.
Additionally, EXCLUDING
-.opendistro_security
inindices
has no effect - same Authorization errorRecovering the .ds underlying indexes work - BUT there will be no Data Stream structure created, so it will be needed to do a manual recovery.
Take a new snapshot, but this time, explicitly EXCLUDE global state and only include the data stream
This must be done WHEN TAKING THE SNAPSHOT ITSELF, including only the datastream
PUT _snapshot/temp-repo/snapshot_20240920_only_data_stream
indices
field (it will result in an Index Not Found error, or a Security Error just like the first execution)POST _snapshot/temp-repo/snapshot_20240920_only_data_stream/_restore
Expected behavior
When restoring from a full, or partial Snapshot, specifying the name of the index pattern in the field
indices
should work without security issues OR index not found errors.At the moment, only restoring the full snapshot works.
TL;DR: This SHOULD WORK FOR ANY SNAPSHOT -> but it does not:
POST _snapshot/temp-repo/any-snapshot-full-or-partial/_restore
SLOW WORKAROUND FOR NOW:
If you cannot take a new partial snapshot and are stuck with a FULL snapshot, which contains special indexes that cannot be recovered without excluding them (eg:
.opendistro_security
), since you CANNOT use theindices
fields, you canPOST _snapshot/temp-repo/FULL_SNAPSHOT/_restore
[DATA-STREAM-NAME]
/_reindex
(you need to manage manual rollovers if you need ISM since if youreindex
everything it will not apply ISM policies until the end!!) from the .ds-name-000_RECOVERED -> to the new DataStreamNOTE: If you have a lot of backing indexes, reindex them ONE BY ONE (not using *), and manual
_rollover
the data stream!This takes a lot of time (in my case, ETA was +80 hours for ~400GB) but works nicely.
----> If you can take a PARTIAL snapshot, do that, since the recovery is much faster.
Additional Details
Plugins
Host/Environment (please complete the following information):
Additional context
This is referenced in this closed issue: #2583 and it's still a problem as of OpenSearch 2.15 (AWS version)
The text was updated successfully, but these errors were encountered: