Here's the case,
In brief :
On bootstrapping a single node, it forms a single node cluster and stores the cluster uuid in its data folder. Now even if it is re-configured to join a multi-node cluster in its yaml file. It will still refer that old cluster uuid from data folder and will not join the new cluster.
In detail :
Create a single node (say node-x) with below configuration and set it up,
cluster.name: elasticsearch_test
node.name: node-x
path.data: C:\ProgramData\Elastic\Elasticsearch\data
path.logs: C:\ProgramData\Elastic\Elasticsearch\logs
http.port: 9200
network.host: 127.0.0.1
transport.tcp.port: 9300
Now set up 2 more nodes (node-2 and node-3) with below configurations to form a cluster,
cluster.name: elasticsearch_test
node.name: node-2
path.data: C:\ProgramData\Elastic\Elasticsearch_node_2\data
path.logs: C:\ProgramData\Elastic\Elasticsearch_node_2\logs
http.port: 9201
network.host: 127.0.0.1
discovery.seed_hosts: ["127.0.0.1:9302","127.0.0.1:9300","127.0.0.1:9301"]
cluster.initial_master_nodes: ["node-x", "node-2", "node-3"]
transport.tcp.port: 9301
You will observe, node-x is not included in the cluster elasticsearch_test yet,
http://localhost:9201/_cat/nodes
Now update the configuration on node-x with below properties and restart node-x to make it join the elasticsearch_test cluster.
discovery.seed_hosts: ["127.0.0.1:9302","127.0.0.1:9300","127.0.0.1:9301"]
cluster.initial_master_nodes: ["node-x", "node-2", "node-3"]
You will observe, node-x has form its own cluster referring the uuid of its last cluster configuration from data folder and haven't joined cluster elasticsearch_test.
Solution : Now delete the contents of data folder of node-x and restart node-x. It will join the cluster elasticsearch_test.
As per Elasticsearch document 7.x :
[Bootstrapping a cluster | Elasticsearch Guide [7.16] | Elastic](http://Bootstrapping a cluster 7.x)
You must set
cluster.initial_master_nodes
to the same list of nodes on each node on which it is set in order to be sure that only a single cluster forms during bootstrapping and therefore to avoid the risk of data loss.