-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Support max_single_primary_size in Resize Action and exposed in ILM #67705
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
Changes from 8 commits
29fc9f9
8139c5f
68297ae
2c23a98
d1f6737
454a9a1
97adec9
6943ddf
43c55ed
e8036d8
675133e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -4,24 +4,24 @@ | |||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
Phases allowed: hot, warm. | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
Sets an index to <<dynamic-index-settings, read-only>> | ||||||||||||||||||||||||||||||||||||||
and shrinks it into a new index with fewer primary shards. | ||||||||||||||||||||||||||||||||||||||
The name of the new index is of the form `shrink-<original-index-name>`. | ||||||||||||||||||||||||||||||||||||||
For example, if the name of the source index is _logs_, | ||||||||||||||||||||||||||||||||||||||
Sets an index to <<dynamic-index-settings, read-only>> | ||||||||||||||||||||||||||||||||||||||
and shrinks it into a new index with fewer primary shards. | ||||||||||||||||||||||||||||||||||||||
The name of the new index is of the form `shrink-<original-index-name>`. | ||||||||||||||||||||||||||||||||||||||
For example, if the name of the source index is _logs_, | ||||||||||||||||||||||||||||||||||||||
the name of the shrunken index is _shrink-logs_. | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
The shrink action allocates all primary shards of the index to one node so it | ||||||||||||||||||||||||||||||||||||||
The shrink action allocates all primary shards of the index to one node so it | ||||||||||||||||||||||||||||||||||||||
can call the <<indices-shrink-index,Shrink API>> to shrink the index. | ||||||||||||||||||||||||||||||||||||||
After shrinking, it swaps aliases that point to the original index to the new shrunken index. | ||||||||||||||||||||||||||||||||||||||
After shrinking, it swaps aliases that point to the original index to the new shrunken index. | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
To use the `shrink` action in the `hot` phase, the `rollover` action *must* be present. | ||||||||||||||||||||||||||||||||||||||
If no rollover action is configured, {ilm-init} will reject the policy. | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
[IMPORTANT] | ||||||||||||||||||||||||||||||||||||||
If the shrink action is used on a <<ccr-put-follow,follower index>>, | ||||||||||||||||||||||||||||||||||||||
If the shrink action is used on a <<ccr-put-follow,follower index>>, | ||||||||||||||||||||||||||||||||||||||
policy execution waits until the leader index rolls over (or is | ||||||||||||||||||||||||||||||||||||||
<<skipping-rollover, otherwise marked complete>>), | ||||||||||||||||||||||||||||||||||||||
then converts the follower index into a regular index with the | ||||||||||||||||||||||||||||||||||||||
<<skipping-rollover, otherwise marked complete>>), | ||||||||||||||||||||||||||||||||||||||
then converts the follower index into a regular index with the | ||||||||||||||||||||||||||||||||||||||
<<ilm-unfollow,unfollow>> action before performing the shrink operation. | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
If the managed index is part of a <<data-streams, data stream>>, | ||||||||||||||||||||||||||||||||||||||
|
@@ -40,14 +40,30 @@ managed indices. | |||||||||||||||||||||||||||||||||||||
[[ilm-shrink-options]] | ||||||||||||||||||||||||||||||||||||||
==== Shrink options | ||||||||||||||||||||||||||||||||||||||
`number_of_shards`:: | ||||||||||||||||||||||||||||||||||||||
(Required, integer) | ||||||||||||||||||||||||||||||||||||||
Number of shards to shrink to. | ||||||||||||||||||||||||||||||||||||||
Must be a factor of the number of shards in the source index. | ||||||||||||||||||||||||||||||||||||||
(Optional, integer) | ||||||||||||||||||||||||||||||||||||||
Number of shards to shrink to. | ||||||||||||||||||||||||||||||||||||||
Must be a factor of the number of shards in the source index. This parameter is conflict with | ||||||||||||||||||||||||||||||||||||||
`max_single_primary_size`, either of them can be set. | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
`max_single_primary_size`:: | ||||||||||||||||||||||||||||||||||||||
(Optional, <<byte-units, byte units>>) | ||||||||||||||||||||||||||||||||||||||
The max single primary shard size of the target index, it's used to find an optimum shards number of the target index. | ||||||||||||||||||||||||||||||||||||||
When this parameter is set properly, each shard's storage of the target index will not be greater than the parameter, | ||||||||||||||||||||||||||||||||||||||
while the shards number of the target index still be a factor of the source index's shards number, but if the parameter | ||||||||||||||||||||||||||||||||||||||
is less than the single shard size of the source index, the shards number of the target index will be equal to the source index's shards number. | ||||||||||||||||||||||||||||||||||||||
For example, when this parameter is set to `50GB`, if the source index has `60` primary shards with `100GB` storage, then the | ||||||||||||||||||||||||||||||||||||||
target index will have `2` primary shards, each shard's storage is `50GB`; if the source index has `60` primary shards | ||||||||||||||||||||||||||||||||||||||
with `1000GB` storage, then the target index will have `20` primary shards; if the source index has `60` primary shards | ||||||||||||||||||||||||||||||||||||||
with `4000GB` storage, then the target index will still have `60` primary shards. This parameter is conflict | ||||||||||||||||||||||||||||||||||||||
with `number_of_shards` in the `settings` parameter, either of them can be set. | ||||||||||||||||||||||||||||||||||||||
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.
Suggested change
|
||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
[[ilm-shrink-ex]] | ||||||||||||||||||||||||||||||||||||||
==== Example | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
[[ilm-shrink-shards-ex]] | ||||||||||||||||||||||||||||||||||||||
===== Set the number of shards of the new shrunken index explicitly | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
[source,console] | ||||||||||||||||||||||||||||||||||||||
-------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||
PUT _ilm/policy/my_policy | ||||||||||||||||||||||||||||||||||||||
|
@@ -65,3 +81,25 @@ PUT _ilm/policy/my_policy | |||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||
-------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
[[ilm-shrink-size-ex]] | ||||||||||||||||||||||||||||||||||||||
===== Calculate the number of shards of the new shrunken index based on the storage of the | ||||||||||||||||||||||||||||||||||||||
source index and the `max_single_primary_size` parameter | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
[source,console] | ||||||||||||||||||||||||||||||||||||||
-------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||
PUT _ilm/policy/my_policy | ||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||
"policy": { | ||||||||||||||||||||||||||||||||||||||
"phases": { | ||||||||||||||||||||||||||||||||||||||
"warm": { | ||||||||||||||||||||||||||||||||||||||
"actions": { | ||||||||||||||||||||||||||||||||||||||
"shrink" : { | ||||||||||||||||||||||||||||||||||||||
"max_single_primary_size": "50GB" | ||||||||||||||||||||||||||||||||||||||
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.
Suggested change
|
||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||
-------------------------------------------------- |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,7 +53,7 @@ PUT /my_source_index/_settings | |
// TEST[s/^/PUT my_source_index\n{"settings":{"index.number_of_shards":2}}\n/] | ||
|
||
<1> Removes replica shards for the index. | ||
<2> Relocates the index's shards to the `shrink_node_name` node. | ||
<2> Relocates the index's shards to the `shrink_node_name` node. | ||
See <<shard-allocation-filtering>>. | ||
<3> Prevents write operations to this index. Metadata changes, such as deleting | ||
the index, are still allowed. | ||
|
@@ -227,3 +227,15 @@ include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=timeoutparms] | |
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=target-index-aliases] | ||
|
||
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=target-index-settings] | ||
|
||
`max_single_primary_size`:: | ||
(Optional, <<byte-units, byte units>>) | ||
The max single primary shard size of the target index, it's used to find an optimum shards number of the target index. | ||
When this parameter is set properly, each shard's storage of the target index will not be greater than the parameter, | ||
while the shards number of the target index still be a factor of the source index's shards number, but if the parameter | ||
is less than the single shard size of the source index, the shards number of the target index will be equal to the source index's shards number. | ||
For example, when this parameter is set to `50GB`, if the source index has `60` primary shards with `100GB` storage, then the | ||
target index will have `2` primary shards, each shard's storage is `50GB`; if the source index has `60` primary shards | ||
with `1000GB` storage, then the target index will have `20` primary shards; if the source index has `60` primary shards | ||
with `4000GB` storage, then the target index will still have `60` primary shards. This parameter is conflict | ||
with `number_of_shards` in the `settings` parameter, either of them can be set. | ||
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. For this I think you can copy the changes made in the previous doc (rather than duplicate them here) |
Uh oh!
There was an error while loading. Please reload this page.