How to set logging replica and shard count on Openshift Container Platform 3
Environment
Red Hat Openshift Container Platform 3.X
Issue
- How to make sure that the existing replica and shard count is preserved during upgrade?
- How to change
.orphaned.*and.operations.*in dc?
Resolution
- There are below ansible variables which can be defined :
`openshift_logging_es_number_of_shards`: The number of primary shards for every new index created in ES. Defaults to '1'.
`openshift_logging_es_number_of_replicas`: The number of replica shards per primary shard for every new index. Defaults to '0'.
If the above variables are not defined, the defaults are applied and can be checked at the Config Maps of the logging project.
$ oc get cm logging-elasticsearch -o yaml | grep "index:" -A2
index:
number_of_replicas: 0
number_of_shards: 1
- Accordingly to This content is not included.BZ # 1552977
The.operations.*and.orphaned.*indices can be changed by Environments variablesREPLICA_SHARDSandPRIMARY_SHARDSwhen using imageopenshift3/logging-elasticsearch/images/v3.9.40-1or later.
Note that:
- Use same value for all Elasticsearch Deploymentconfigs.
- Run
oc rollout latest $ES_DCto apply the changes - To avoid conflict, do not run
oc rolloutin mid-night when the index is creating. - The Environment variables may lose when re-run playbooks.
Eg. Expected result after accessing the pod.
# QUERY=_template/common.settings.operations.orphaned.json?pretty es_util
{
"common.settings.operations.orphaned.json" : {
"order" : 5,
"template" : ".orphaned*",
"settings" : {
"index" : {
"refresh_interval" : "5s",
"unassigned" : {
"node_left" : {
"delayed_timeout" : "2m"
}
},
"number_of_shards" : "2",
"translog" : {
"flush_threshold_size" : "256mb"
},
"number_of_replicas" : "1"
}
},
"mappings" : { },
"aliases" : { }
}
}
To set replica count on existing indices, see solution 3167341
SBR
Product(s)
Components
Category
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.