elasticsearchsharding

Elasticsearch Error - Cluster health status changed from [YELLOW] to [RED] (reason: [shards failed


I am using elasticdump to dump a huge dataset into an elasticsearch node with the command : elasticdump --input=./xyz.json --output=http://localhost:9200/ . Everything goes normal but after some time I see these error messages in the console:

_type: 'doc',
_id: 'lzHMQmUBQ1VCv6VBROQA',
status: 503,
error:
{ type: 'unavailable_shards_exception',
 reason: '[logstash-2018.08.16][2] primary shard is not active Timeout: 
[1m], request: [BulkShardRequest [[logstash-2018.08.16][2]] containing [31] requests]' } }

On inspection of the elasticsearch logs, the following errors are visible :

[2018-08-31T11:27:21,496][INFO ][o.e.c.r.a.AllocationService] [dqSwClD] Cluster health status changed from [YELLOW] to [RED] (reason: [shards failed [[logstash-2018.08.16][2]] ...]).

I am not sure what has caused the shard failure and several troubleshooting efforts have proved abortive.


Solution

  • As you can find at https://www.elastic.co/guide/en/elasticsearch/reference/master/tune-for-indexing-speed.html, there are plenty tips to optimize bulk indexing: