Hi,
I have a single Elasticsearch node on Amazon EC2 instance. I've also mounted AWS Elastic File System to the instance under /usr/share/elasticsearch. When I start elasticsearch it starts normally and I can see that it creates files on the mounted EFS, but when I try to index a document I get this error:
{ "error" : { "root_cause" : [ { "type" : "unavailable_shards_exception", "reason" : "[customer][3] primary shard is not active Timeout: [1m], request: [index {[customer][external][1], source[\n{\n \"name\": \"John Doe\"\n}]}]" } ], "type" : "unavailable_shards_exception", "reason" : "[customer][3] primary shard is not active Timeout: [1m], request: [index {[customer][external][1], source[\n{\n \"name\": \"John Doe\"\n}]}]" }, "status" : 503 }
When I look at the elasticsearch output I see this error:
[2016-07-19 10:19:34,241][INFO ][cluster.metadata ] [Zarek] [customer] creating index, cause [auto(index api)], templates [], shards [5]/[1], mappings [external] [2016-07-19 10:19:34,348][WARN ][indices.cluster ] [Zarek] [[customer][1]] marking and sending shard failed due to [failed to create shard] java.lang.NullPointerException at org.elasticsearch.index.shard.ShardPath.selectNewPathForShard(ShardPath.java:241) at org.elasticsearch.index.IndexService.createShard(IndexService.java:336) at org.elasticsearch.indices.cluster.IndicesClusterStateService.applyInitializingShard(IndicesClusterStateService.java:601) at org.elasticsearch.indices.cluster.IndicesClusterStateService.applyNewOrUpdatedShards(IndicesClusterStateService.java:501) at org.elasticsearch.indices.cluster.IndicesClusterStateService.clusterChanged(IndicesClusterStateService.java:166) at org.elasticsearch.cluster.service.InternalClusterService.runTasksForExecutor(InternalClusterService.java:610) at org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterService.java:772) at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:231) at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:194) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) [2016-07-19 10:19:34,351][WARN ][cluster.action.shard ] [Zarek] [customer][1] received shard failed for target shard [[customer][1], node[35FNNM0hSsCWOyRQZPsz8A], [P], v[1], s[INITIALIZING], a[id=piu83IRBQNCpi2OLm4aGrw], unassigned_info[[reason=INDEX_CREATED], at[2016-07-19T10:19:34.252Z]]], indexUUID [ii2mnw8tQaCrfQ27Z5tkvA], message [failed to create shard], failure [NullPointerException[null]] java.lang.NullPointerException ... [2016-07-19 10:19:34,364][WARN ][indices.cluster ] [Zarek] [[customer][3]] marking and sending shard failed due to [failed to create shard] java.lang.NullPointerException
The cluster health shows this:
{ "cluster_name" : "elasticsearch", "status" : "red", "timed_out" : false, "number_of_nodes" : 1, "number_of_data_nodes" : 1, "active_primary_shards" : 0, "active_shards" : 0, "relocating_shards" : 0, "initializing_shards" : 0, "unassigned_shards" : 10, "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" : 0.0 }
Clearly elasticsearch cannot create shards on the Elastic File System. However at the same time it is able to use it as it stores a bunch of files and folders on it (like /usr/share/elasticsearch/nodes/0/indices and /usr/share/elasticsearch/nodes/0/_state).
I added rwx permissions to everyone under the mounted /usr/share/elasticsearch, but it doesn't help.
Selinux is also disabled.
Forcing shards reallocation doesn't help either.
Am I missing something in regard to Elasticsearch and NFS permissions?