# Failed to determine the health of the cluster

**URL:** <https://discuss.elastic.co/t/failed-to-determine-the-health-of-the-cluster/318818>\
**Category:** Elasticsearch\
**Created:** [November 14, 2022, 2:20am UTC](https://discuss.elastic.co/t/failed-to-determine-the-health-of-the-cluster/318818 "2022-11-14T02:20:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![richardvk](https://avatars.discourse-cdn.com/v4/letter/r/3ab097/32.png) [@richardvk](https://discuss.elastic.co/u/richardvk)\
**Post date:** [November 14, 2022, 2:20am UTC](https://discuss.elastic.co/t/failed-to-determine-the-health-of-the-cluster/318818/1 "2022-11-14T02:20:53Z")

</div>

Im trying to enable clustering as per:

> **[Add and remove nodes in your cluster | Elasticsearch Guide \[8.5\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/add-elasticsearch-nodes.html)**

I get this when creating a token:

```auto
root@elk-1 ~ # /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s node

ERROR: Failed to determine the health of the cluster.

```

However, this works:

```auto
root@elk-1 ~ # curl -X GET "localhost:9200/_cluster/health?pretty"
{
  "cluster_name" : "my-cluster",
  "status" : "yellow",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 10,
  "active_shards" : 10,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 1,
  "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" : 90.9090909090909
}

```

I have tried changing a few things in elasticsearch.yml, but no luck. These include:

- disabling "cluster.initial\_master\_nodes"
- adding discovery.type: single-node

Doesnt seem to be much info out there on this issue. Any help much apprecietaed.

---

<div class="post-metadata">

**Author:** ![richardvk](https://avatars.discourse-cdn.com/v4/letter/r/3ab097/32.png) [@richardvk](https://discuss.elastic.co/u/richardvk)\
**Post date:** [November 20, 2022, 11:33pm UTC](https://discuss.elastic.co/t/failed-to-determine-the-health-of-the-cluster/318818/2 "2022-11-20T23:33:16Z")

</div>

Documenting some new (hard won) findings in case anyone else comes across this and struggles like I did.

This error was initially caused by this (incorrect) setting in the elasticsearch.yml file:  
xpack.security.enabled: false

Changing it to true allowed the node to generate a token.

But more importantly, an Elasticsearch instance installed on Ubuntu/Debian with apt will already have security setting in the config file EVEN IF it has never been started. So in my mind at least its a bit half baked, as in, some documentation suggests that with a new node, you must start Elasticsearch for the very first time with a token generated on another node. But this fails if ES was installed with apt and has some ready-and-waiting security config. I wish the error message would be more clear about this. In this case, you need to run elasticsearch-reconfigure-node first.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 18, 2022, 11:34pm UTC](https://discuss.elastic.co/t/failed-to-determine-the-health-of-the-cluster/318818/3 "2022-12-18T23:34:08Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
