0

Problem: I've started five elasticsearch nodes, but only 66,84 % of the Data is in kibana available. When I check the cluster health with localhost:9200/_cluster/health?pretty=true I've got the following informations: { "cluster_name" : "A2A", "status" : "red", "timed_out" : false, "number_of_nodes" : 5, "number_of_data_nodes" : 4, "active_primary_shards" : 612, "active_shards" : 613, "relocating_shards" : 0, "initializing_shards" : 0, "unassigned_shards" : 304, "delayed_unassigned_shards" : 0, "number_of_pending_tasks" : 0, "number_of_in_flight_fetch" : 0, "task_max_waiting_in_queue_millis" : 0, "active_shards_percent_as_number" : 66.8484187568157 }

And also all my indices are red, except of the kibana index.

Small Part:

red open logstash-2015.11.08 5 0 47256 668 50.5mb 50.5mb red open logstash-2015.11.09 5 0 46540 1205 50.4mb 50.4mb red open logstash-2015.11.06 5 0 65645 579 69.2mb 69.2mb red open logstash-2015.11.07 5 0 62733 674 66.4mb 66.4mb green open .kibana 1 1 2 0 19.7kb 9.8kb red open logstash-2015.11.11 5 0 49254 1272 53mb 53mb red open logstash-2015.11.12 5 0 50885 466 53.6mb 53.6mb red open logstash-2015.11.10 5 0 49174 1288 52.6mb 52.6mb red open logstash-2016.04.12 5 0 92508 585 104.8mb 104.8mb red open logstash-2016.04.13 5 0 95120 279 107.2mb 107.2mb

I've tried to fix the problem with curl -XPUT 'localhost:9200/_settings' -d ' {"index.routing.allocation.disable_allocation": false}' but it doesn't work!

So has anyone of you some ideas how to assign my shards?

And when you need some other infos please ask and I will try to offer you the data:

LUIGI
  • 41
  • 2
  • 10

2 Answers2

2

Have you seen this answer? https://stackoverflow.com/a/23816954/1834331

You could also try restarting elasticsearch first: service elasticsearch restart.

Otherwise, just try reallocating the shards manually (as your indices have 5 shards, run the command with the shard flag 0, 1, 2, .. 5):

curl -XPOST -d '{ "commands" : [ {
  "allocate" : {
       "index" : "logstash-2015.11.08", 
       "shard" : 0, 
       "node" : "SOME_NODE_HERE",
       "allow_primary":true 
     } 
  } ] }' http://localhost:9200/_cluster/reroute?pretty`

You can check the nodes with unassigned shards using: curl -s localhost:9200/_cat/shards | grep UNASS

Community
  • 1
  • 1
Mihai Ionescu
  • 908
  • 1
  • 8
  • 13
0

if shards are stuck in unallocated they can be manually allocated. For example:

curl -XPOST 'localhost:9200/_cluster/reroute' -d '{
    "commands": [{
        "allocate": {
            "index": "logstash-2015.11.07",
            "shard": 5,
            "node": "Frederick Slade",
            "allow_primary": 1
        }
    }]
}'

See the Cluster Reroute documentation, including warnings on the use of allow_primary.

Olly Cruickshank
  • 5,602
  • 3
  • 30
  • 30