Skip to content
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

Remove hardcoded index.number_of_replicas: 1 #3877

Closed
dgrabows opened this issue May 19, 2015 · 5 comments · Fixed by #3890
Closed

Remove hardcoded index.number_of_replicas: 1 #3877

dgrabows opened this issue May 19, 2015 · 5 comments · Fixed by #3890

Comments

@dgrabows
Copy link
Contributor

When creating the kibana index (.kibana by default), the number of replicas for the index is set to 1. This setting is hard-coded in create_kibana_index.js.

When using Kibana 4.0.2 with a single node Elasticsearch cluster, this causes the Elasticsearch cluster to go into a "yellow" state due to the unassigned shard replica. This can be corrected by updating the settings of the index after it is created by Kibana. However, the index is only created after the Kibana UI is accessed for the first time, not when the Kibana server is started for the first time. This makes automating the setup of Kibana 4 awkward, because it requires a manual step or the automated scripts (Chef recipes in my particular case) to load the UI. I assume this is also true for snapshot builds of 4.1.0, because the hard-coded value is present in master.

I tried to override this setting by creating an index template in Elasticsearch prior to Kibana creating the index, but the explicit setting provided when creating the index took precedence. The index template I created was:

{
  "kibana-config" : {
    "order" : 0,
    "template" : ".kibana",
    "settings" : {
      "index.number_of_replicas" : "0",
      "index.number_of_shards" : "1"
    },
    "mappings" : { },
    "aliases" : { }
  }
}

One way to make automated configuration of Kibana easier for Elasticsearch clusters with one node, or cases where more than one replica of the kibana index is desired, would be to add a setting to kibana.yml for the number of replicas. Perhaps "kibana_index_replicas" to go along with the existing "kibana_index" property for controlling the name of the index?

This issue was previously raised in #2727, which was closed due to what I believe was some confusion over the proposed solution. That issue suggests allowing an index template to be provided for the kibana index, similar to the way that logstash allows an index template to be provided when using the elasticsearch output.

dgrabows added a commit to dgrabows/kibana that referenced this issue May 19, 2015
…he number of replicas for the index used to store Kibana dashboards, settings, etc. in Elasticsearch. Resolves elastic#3877.
@rashidkpc rashidkpc changed the title Make default number of replicas for kibana index configurable Remove hardcoded index.number_of_replicas: 1 May 19, 2015
@rashidkpc
Copy link
Contributor

See comment on #3878, we're going to simply remove this hardcoded value and let you do it via an elasticsearch template.

@dgrabows
Copy link
Contributor Author

I agree that removing the explicit value for number_of_replicas on index creation makes more sense than the approach I suggested.

Would a pull request for this new approach be helpful, or does it not make sense for a change this small?

@rashidkpc
Copy link
Contributor

You're welcome to submit a pull for the change, we'll get it merged ASAP! I'll go ahead and close #3878 for now

@zoltanmaric
Copy link

Unfortunately it seems that elasticsearch now has a hard-coded default value for the number of replicas and it's 1. So installing kibana on a single-node cluster will immediately make it yellow, as the .kibana index will not be able to replicate.

I'm not sure whether the setting for selecting the number of replicas on the Kibana index should be reinstated here, or if elasticsearch should enable configuring the default number of replicas. Possibly both.

@bailando2020
Copy link

This is a possible solution after creating index:
curl -X PUT "localhost:9200/.kibana/_settings" -H 'Content-Type: application/json' -d'
{
"index" : {
"number_of_replicas" : 0,
"auto_expand_replicas": "0-0"
}
}
'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants