Failed to determine the health of the cluster

Im trying to enable clustering as per:

I get this when creating a token:

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:

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.

1 Like

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.

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