public interface IndexSet extends Comparable<IndexSet>
Modifier and Type | Interface and Description |
---|---|
static class |
IndexSet.IndexNameComparator |
Modifier and Type | Method and Description |
---|---|
void |
cleanupAliases(Set<String> indices)
This ensures that the write index alias only points to the newest index.
|
void |
cycle()
Creates a new index and points the write index alias to it.
|
Optional<Integer> |
extractIndexNumber(String index)
Extracts the index number from an index name.
|
String |
getActiveWriteIndex()
Returns the active write index.
|
Map<String,Set<String>> |
getAllIndexAliases()
Returns a map where the key is an index name and the value a set of aliases for this index.
|
IndexSetConfig |
getConfig()
The configuration for this index set.
|
String |
getIndexPrefix()
Returns the index prefix for this index set.
|
String |
getIndexWildcard()
Returns the index wildcard for this index set.
|
String[] |
getManagedIndices()
Returns an array with all managed indices in this index set.
|
String |
getNewestIndex()
Returns the newest index.
|
String |
getWriteIndexAlias()
Returns the write index alias name for this index set.
|
boolean |
isManagedIndex(String index)
Checks if the given index name is part of this index set.
|
boolean |
isUp()
Checks if the write index alias exists.
|
boolean |
isWriteIndexAlias(String index)
Checks if the given index name is equals to the write index alias.
|
void |
pointTo(String newIndexName,
String oldIndexName)
Changes the write index alias from the old index to the new one.
|
void |
setUp()
Prepares this index set to receive new messages.
|
compareTo
String[] getManagedIndices()
Example: ["graylog_0", "graylog_1", "graylog_2"]
String getWriteIndexAlias()
The write index alias always points to the newest index.
Example: "graylog_deflector"
String getIndexWildcard()
This can be used in Elasticsearch queries to match all managed indices in this index set.
Example: "graylog_*"
String getNewestIndex() throws NoTargetIndexException
Example: "graylog_42"
NoTargetIndexException
- if there are no indices in this index set yet@Nullable String getActiveWriteIndex() throws TooManyAliasesException
Incoming messages for this index set will be written into this index.
Example: "graylog_42"
TooManyAliasesException
- if the write index alias points to more than one indexMap<String,Set<String>> getAllIndexAliases()
Only the active write index should have an alias, the other values should be empty.
Example: {graylog_0=[], graylog_1=[], graylog_2=[graylog_deflector}
String getIndexPrefix()
Example: "graylog"
boolean isUp()
boolean isWriteIndexAlias(String index)
index
- index name to checkboolean isManagedIndex(String index)
index
- index name to checkvoid setUp()
void cycle()
void cleanupAliases(Set<String> indices)
Can be used to fix the aliases in this index set when a TooManyAliasesException
has been thrown.
indices
- list of indices where the index alias points tovoid pointTo(String newIndexName, String oldIndexName)
newIndexName
- index to add the write index alias tooldIndexName
- index to remove the write index alias fromOptional<Integer> extractIndexNumber(String index)
Example: "graylog_42" => 42
index
- index nameOptional
with the extracted index number, an empty one if the number couldn't be parsedIndexSetConfig getConfig()
Copyright © 2012–2019 Graylog, Inc.. All rights reserved.