Search code examples
elasticsearchkibanakibana-4

Elasticsearch cluster health: yellow (131 of 262) unassigned shards


I'm very new to Elasticsearch and try to use it for analyze of data from Suricata IPS. Head plugin shows me this: yellow (131 of 262) unassigned shards also getting this:

$ curl -XGET http://127.0.0.1:9200/_cluster/health?pretty
{
  "cluster_name" : "elasticsearch_brew",
  "status" : "yellow",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 131,
  "active_shards" : 131,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 131,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0
}

How to get rid of those unassigned shards? And also Kibana says me this from time to time:

Error: Bad Gateway
    at respond (https://www.server.kibana/index.js?_b=:85279:15)
    at checkRespForFailure (https://www.server.kibana/index.js?_b=:85247:7)
    at https://www.server.kibana/index.js?_b=:83885:7
    at wrappedErrback (https://www.server.kibana/index.js?_b=:20902:78)
    at wrappedErrback (https://www.server.kibana/index.js?_b=:20902:78)
    at wrappedErrback (https://www.server.kibana/index.js?_b=:20902:78)
    at https://www.server.kibana/index.js?_b=:21035:76
    at Scope.$eval (https://www.server.kibana/index.js?_b=:22022:28)
    at Scope.$digest (https://www.server.kibana/index.js?_b=:21834:31)
    at Scope.$apply (https://www.server.kibana/index.js?_b=:22126:24)

I don't know if these problems connected to each other... Could please anyone help me to get it work. Thank you very much!


Solution

  • A cluster with only one node and indices that have one replica will always be yellow.

    yellow is not a bad thing, the cluster works perfectly fine. The downside is it doesn't have the copies of the shards active.

    You can have a green cluster if youbset the number of replicas to 0 or you add a second node to the cluster.

    But, as I said, there is no problem if you have a yellow cluster.

    Setting number of replicas to 0, cluster wide (all indices):

    curl -XPUT "http://localhost:9200/_settings" -d'
    {
      "number_of_replicas" : 0
    }'