Does node.name need to match ip or hostname?

Hi,

I am setting up my first multi node cluster.

I only made it running, when the node.name equals to the hostname. It did not work when I said:

cluster.name: multinode
node.name: 0

hostname is multinode-es-0

I had 3 servers using this type of naming convention (0 to 2). During cluster bootstrap the nodes have not been able to discover themself when I set
discovery.seed_hosts and cluster.initial_master_nodes to following value:

["multinode-es-0", "multinode-es-1", "multinode-es-2"]

I expected that elasticsearch to discover any nodes on the given hostnames which are part of the same cluster.name.
I only made it running when setting node.name to hostname.

Was my assumption incorrect or did I just do a mistake during configuration?

Thanks, Andreas

I wouldn't recommend using a bare number like 0 for the node name because it will be hard to identify this as a node name when looking at responses from Elasticsearch like GET _cat/nodes. It will work, but it will be confusing.

discovery.seed_hosts needs to be set to hostnames or IP addresses since this is about discovery, i.e. allowing the nodes to connect to each other.

cluster.initial_master_nodes should be set to node names, but once your cluster has formed you can remove it.