ERROR: Aborting enrolling to cluster. Could not communicate with the node on any of the addresses from the enrollment token. All of [ip:9200] were attempted

Hi,

I tried to join new node to existing Elastic cluster.
I'm using Elasticsearch version 8.4.1

Tried steps for new node:

  1. sudo rpm --install elasticsearch-8.4.1-x86_64.rpm
  2. /usr/share/elasticsearch/bin/elasticsearch-reconfigure-node --enrollment-token

I got this error at 2nd step.

Existing cluster (single node-cluster) configuration:
node1
cluster.name: my-application
node.name: node1
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 0.0.0.0
http.port: 9200
discovery.seed_hosts: [" ip node1", "ip node2"]
xpack.security.enabled: true
xpack.security.enrollment.enabled: true
xpack.security.http.ssl:
enabled: true
keystore.path: certs/http.p12
xpack.security.transport.ssl:
enabled: true
verification_mode: certificate
keystore.path: certs/transport.p12
truststore.path: certs/transport.p12

cluster.initial_master_nodes: ["localhost.localdomain"]
http.host: 0.0.0.0
transport.host: 0.0.0.0

New node configuration(node2):
custer.name: my-application
node.name: node2
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 0.0.0.0
http.port: 9200
discovery.seed_hosts: ["ip node1", "ip node2"]

xpack.security.enabled: true
xpack.security.enrollment.enabled: true

xpack.security.http.ssl:
enabled: true
keystore.path: certs/http.p12

xpack.security.transport.ssl:
enabled: true
verification_mode: certificate
keystore.path: certs/transport.p12
truststore.path: certs/transport.p12
cluster.initial_master_nodes: ["localhost.localdomain"]

http.host: 0.0.0.0
transport.host: 0.0.0.0

Error on node2
[root@localhost ~]# /usr/share/elasticsearch/bin/elasticsearch-reconfigure-node --enrollment-token eyJ2ZXIiOiI4LjQuMSIsImFkciI6WyIxOTIuMTY4LjYwLjEzODo5MjAwIl0sImZnciI6ImQxOGU3NDYyZWI5MDM0OTJmMWM1MTYyOWUyNzhhODkzMTZhMDNmNGZjMWI1NWRiMWQ4ZDczNDEyNmZiMTViOTAiLCJrZXkiOiJZN3RMVW9NQlhhMTFibXNWWE5NQjpFNk9vUDY4OVNxU0xHRERVcDcwNjhRIn0=

This node will be reconfigured to join an existing cluster, using the enrollment token that you provided.
This operation will overwrite the existing configuration. Specifically:

  • Security auto configuration will be removed from elasticsearch.yml
  • The [certs] config directory will be removed
  • Security auto configuration related secure settings will be removed from the elasticsearch.keystore
    Do you want to continue with the reconfiguration process [y/N]y
    Unable to communicate with the node on https://ip node1:9200/_security/enroll/node. Error was No route to host
    ERROR: Aborting enrolling to cluster. Could not communicate with the node on any of the addresses from the enrollment token. All of [ip node1:9200] were attempted.

Thank You...!