-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Dangling indices documentation #58751
Merged
pugnascotia
merged 15 commits into
elastic:master
from
pugnascotia:dangling-indices-docs
Jul 3, 2020
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
6fc5002
Initial dangling indices docs
pugnascotia 2dce37c
Fixes and polishing
pugnascotia 02ee01d
Disable auto_import_dangling_indices by default
pugnascotia 27f4bbc
Merge remote-tracking branch 'upstream/master' into dangling-indices-…
pugnascotia e8470f4
Fixes
pugnascotia 4b1ab53
Merge remote-tracking branch 'upstream/master' into dangling-indices-…
pugnascotia df0943f
Revert server changes
pugnascotia aefca75
Merge remote-tracking branch 'upstream/master' into dangling-indices-…
pugnascotia a625812
Apply suggestions from code review
pugnascotia 8135376
Apply suggestions from code review
pugnascotia 5188297
Reference snippet instead of duplicating content
pugnascotia 5bd84b5
Strengthen warnings around dangling index imports
pugnascotia 873d865
Add an example of importing an dangling index
pugnascotia 6c931a8
Add missing params to delete page
pugnascotia f0b53eb
Typo
pugnascotia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
[[dangling-index-delete]] | ||
=== Delete dangling index API | ||
++++ | ||
<titleabbrev>Delete dangling index</titleabbrev> | ||
++++ | ||
|
||
Deletes a dangling index. | ||
|
||
[[dangling-index-delete-api-request]] | ||
==== {api-request-title} | ||
|
||
[source,console] | ||
-------------------------------------------------- | ||
DELETE /_dangling/<index-uuid>?accept_data_loss=true | ||
-------------------------------------------------- | ||
// TEST[skip:Difficult to set up] | ||
|
||
[[dangling-index-delete-api-desc]] | ||
==== {api-description-title} | ||
|
||
include::{es-repo-dir}/indices/dangling-indices-list.asciidoc[tag=dangling-index-description] | ||
|
||
|
||
Deletes a dangling index by referencing its UUID. Use the | ||
<<dangling-indices-list,List dangling indices API>> to locate the UUID of an index. | ||
|
||
|
||
[[dangling-index-delete-api-path-params]] | ||
==== {api-path-parms-title} | ||
|
||
`<index-uuid>`:: | ||
(Required, string) | ||
UUID of the index to delete. You can find this using the | ||
<<dangling-indices-list,List dangling indices API>>. | ||
|
||
[[dangling-index-delete-api-query-params]] | ||
==== {api-query-parms-title} | ||
|
||
`accept_data_loss`:: | ||
(Optional, boolean) | ||
This field must be set to `true` in order to carry out the import, since it will | ||
no longer be possible to recover the data from the dangling index. | ||
|
||
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=timeout] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
[[dangling-index-import]] | ||
=== Import dangling index API | ||
++++ | ||
<titleabbrev>Import dangling index</titleabbrev> | ||
++++ | ||
|
||
Imports a dangling index. | ||
|
||
[[dangling-index-import-api-request]] | ||
==== {api-request-title} | ||
|
||
[source,console] | ||
-------------------------------------------------- | ||
POST /_dangling/<index-uuid>?accept_data_loss=true | ||
-------------------------------------------------- | ||
// TEST[skip:Difficult to set up] | ||
|
||
[[dangling-index-import-api-desc]] | ||
==== {api-description-title} | ||
|
||
include::{es-repo-dir}/indices/dangling-indices-list.asciidoc[tag=dangling-index-description] | ||
|
||
Import a single index into the cluster by referencing its UUID. Use the | ||
<<dangling-indices-list,List dangling indices API>> to locate the UUID of an index. | ||
|
||
|
||
[[dangling-index-import-api-path-params]] | ||
==== {api-path-parms-title} | ||
|
||
`<index-uuid>`:: | ||
(Required, string) | ||
UUID of the index to import, which you can find using the | ||
<<dangling-indices-list,List dangling indices API>>. | ||
|
||
[[dangling-index-import-api-query-params]] | ||
==== {api-query-parms-title} | ||
|
||
`accept_data_loss`:: | ||
(Required, boolean) | ||
This field must be set to `true` to import a dangling index. Because {es} | ||
cannot know where the dangling index data came from or determine which shard | ||
copies are fresh and which are stale, it cannot guarantee that the imported data | ||
represents the latest state of the index when it was last in the cluster. | ||
|
||
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=timeout] | ||
|
||
[[dangling-index-import-api-example]] | ||
==== {api-examples-title} | ||
|
||
The following example shows how to import a dangling index: | ||
|
||
[source,console] | ||
-------------------------------------------------- | ||
POST /_dangling/zmM4e0JtBkeUjiHD-MihPQ?accept_data_loss=true | ||
-------------------------------------------------- | ||
// TEST[skip:Difficult to set up] | ||
|
||
The API returns following response: | ||
|
||
[source,console-result] | ||
-------------------------------------------------- | ||
{ | ||
"acknowledged" : true | ||
} | ||
-------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
[[dangling-indices-list]] | ||
=== List dangling indices API | ||
++++ | ||
<titleabbrev>List dangling indices</titleabbrev> | ||
++++ | ||
|
||
Lists dangling indices. | ||
|
||
[[dangling-indices-list-api-request]] | ||
==== {api-request-title} | ||
|
||
[source,console] | ||
-------------------------------------------------- | ||
GET /_dangling | ||
-------------------------------------------------- | ||
// TEST[skip:TBD] | ||
|
||
[[dangling-indices-list-api-desc]] | ||
==== {api-description-title} | ||
|
||
// tag::dangling-index-description[] | ||
If {es} encounters index data that is absent from the current cluster | ||
state, those indices are considered to be dangling. For example, | ||
this can happen if you delete more than | ||
`cluster.indices.tombstones.size` indices while an {es} node is offline. | ||
// end::dangling-index-description[] | ||
|
||
Use this API to list dangling indices, which you can then | ||
<<dangling-index-import,import>> or <<dangling-index-delete,delete>>. | ||
|
||
|
||
[[dangling-indices-list-api-example]] | ||
==== {api-examples-title} | ||
|
||
The API returns the following response: | ||
|
||
[source,console-result] | ||
-------------------------------------------------- | ||
{ | ||
"dangling_indices": [ | ||
"index_name": "twitter", | ||
"index_uuid": "zmM4e0JtBkeUjiHD-MihPQ", | ||
"creation_date_millis": 1589414451372, | ||
"node_ids": [ | ||
"pL47UN3dAb2d5RCWP6lQ3e" | ||
] | ||
] | ||
} | ||
-------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,9 +56,29 @@ NOTE: These settings only take effect on a full cluster restart. | |
[[dangling-indices]] | ||
==== Dangling indices | ||
|
||
When a node joins the cluster, any shards stored in its local data | ||
directory which do not already exist in the cluster will be imported into the | ||
cluster. This functionality is intended as a best effort to help users who | ||
lose all master nodes. If a new master node is started which is unaware of | ||
the other indices in the cluster, adding the old nodes will cause the old | ||
indices to be imported, instead of being deleted. | ||
When a node joins the cluster, if it finds any shards stored in its local data | ||
directory that do not already exist in the cluster, it will consider those | ||
shards to be "dangling". Importing dangling indices | ||
into the cluster using `gateway.auto_import_dangling_indices` is not safe. | ||
Instead, use the <<dangling-indices-api,Dangling indices API>>. Neither | ||
mechanism provides any guarantees as to whether the imported data truly | ||
represents the latest state of the data when the index was still part of | ||
the cluster. | ||
|
||
`gateway.auto_import_dangling_indices`:: | ||
|
||
deprecated:[7.9.0, This setting will be removed in 8.0. You should use the dedicated dangling indices API instead.] | ||
Whether to automatically import dangling indices into the cluster | ||
state, provided no indices already exist with the same name. Defaults | ||
to `false`. | ||
|
||
WARNING: The auto-import functionality was intended as a best effort to help users | ||
who lose all master nodes. For example, if a new master node were to be | ||
started which was unaware of the other indices in the cluster, adding the | ||
old nodes would cause the old indices to be imported, instead of being | ||
deleted. However there are several issues with automatic importing, and | ||
its use is strongly discouraged in favour of the | ||
<<dangling-indices-api,dedicated API>. | ||
|
||
WARNING: Losing all master nodes is a situation that should be avoided at | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lockewritesdocs Is it overkill to have two |
||
all costs, as it puts your cluster's metadata and data at risk. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if we should add that that scenario (losing all master nodes) should be avoided at all cost, as it puts the cluster's metadata and data at risk. Also worth pointing out above (when talking about "this is not safe") that importing dangling indices does not provide any guarantees as to whether the data that's imported truly represents the latest state of the data as it was when the index was still part of the cluster.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ywelsch I've reworked the text to and address your points.