-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Description
Original comment by @clintongormley:
In Index Lifecycle Management we have come across a problem with rollover which we hope to solve with a change to aliases.
Problem 1: Rollover requires an alias
Rollovers creates a new index, then changes the alias from pointing to the old index to point to the new index.
The alias name is the only index-specific value that is needed by the ILM policy today, because of the rollover action. If we manage to remove this requirement, then the same policy could be applied to several different index patterns/templates. The rollover action in ILM needs a way to inspect the index to know which alias should be swapped. (eg you shouldn't swap an alias like all-logs which is intended for reading).
Problem 2: Coordinating multiple settings
We could add a setting like index.lifecycle.rollover_alias to know which alias to use, but we also need to add the alias to the first index to bootstrap the process. It would be more convenient to have a single way of specifying the alias.
Problem 3: A multi-index alias cannot be used for writing
The rollover alias cannot be applied to more than one index, otherwise it cannot be used for indexing.
Beats or Logstash need to be able to bootstrap ILM and indices by:
- Putting the ILM policy if it doesn't exist
- Putting the index template if it doesn't exist
- Creating the initial index (eg
mysql-logs-2018.01.01-00001) with the appropriate alias:mysql-logs-write)
Imagine a thousand beats doing this near midnight: you could create two indices with different dates, both of which have the mysql-logs-write alias, so causing indexing to fail. Ideally, we need a way to stop index creation if the alias is already in use.
Proposal
- We add a
typeormodeparameter to aliases, which can be set toread_onlyorread_write. read_onlyaliases can point to multiple indices.read_writealiases can only point to a single index, and an exception will be thrown at index creation time or alias update time if the user tries to assign aread_writealias to more than one index.- When rollover is called on an index (instead of an alias), then all
read_writealiases will be switched to the new index, butread_onlyaliases will not be changed. - For BWC, any aliases which currently point to multiple indices will automatically become
read_only, but single-index aliases will remain unspecified. We add a deprecation warning to say that thetypewill become mandatory in 7.0