Newbie question: which index setting will be used in different nodes?

For example, there are node1 and node2 in cluster.

node1:

index.number_of_shards: 5
index.number_of_replicas: 1

node2:

index.number_of_shards: 3
index.number_of_replicas: 2

Which setting will be used when creating an index? Is there any document to explain this?

Thanks

Use index templates.

This setting is removed in 5.0.

This is an example.

I mean if there are same setting keys with different values across the cluster, which setting will take effect in this cluster.

For example:

node1:

discovery.zen.minimum_master_nodes: 1

node2:

discovery.zen.minimum_master_nodes: 2

WIll node1 become a cluster with itself or wait for node2 to come and consist a cluster?

Good question.

I believe that If no cluster exists then the first node which will start will read this value from elasticsearch.yml.
With that the cluster state will be created.

When a new node starts, it uses the values available in the cluster state.

I did not check the code or tested it so I could be wrong though.

But for settings starting with node., those are read by the node when it starts.
It means that those settings are local to the node.

My 2 cents

1 Like

I found following description in the official document:

The master node is responsible for lightweight cluster-wide actions such as creating or deleting an index, tracking which nodes are part of the cluster, and deciding which shards to allocate to which nodes.

I think it's the master to decide the cluster setting.

Sure. The master updates the cluster state.
With a new cluster, the master is the first node basically.