How many nodes elastic search creates on single machine by defaults

I have ELK setup. with elastic search version 2.3.x. ( kibana 4.4.2 and logstash=1:2.2.4-1). I wanted to know how many nodes by default it should create.

I have noticed a weird situation. When I restarted elastic search it started with 3 nodes. There are multiple folder in data path ( /var/lib/elasticsearch/0 , 1 , 2 ,3).

root@KibanaServer:/usr/share/elasticsearch# ls -ld /var/lib/elasticsearch/elasticsearch/nodes/*
drwxr-xr-x 4 elasticsearch elasticsearch 4096 Feb 27 15:16 /var/lib/elasticsearch/elasticsearch/nodes/0
drwxr-xr-x 4 elasticsearch elasticsearch 4096 Feb 25 15:55 /var/lib/elasticsearch/elasticsearch/nodes/1
drwxr-xr-x 4 elasticsearch elasticsearch 4096 Feb 25 15:55 /var/lib/elasticsearch/elasticsearch/nodes/2
drwxr-xr-x 4 elasticsearch elasticsearch 4096 Feb 25 15:55 /var/lib/elasticsearch/elasticsearch/nodes/3

But when I restart it again it took only one node. I wanted to know how it is defining a number of nodes.

curl -s -XGET "http://localhost:9200/_cat/nodes?v"
host ip heap.percent ram.percent load node.role master name
192.168.56.190 192.168.56.190 17 37 0.08 d * Bonita Juarez

Because of this many shared are showing un-assigned due to lack of nodes.

Also, If there is only one node going to create then why all index are having 5primary and replicas shards of each as default setting.

As far as I know 5 shard with one replica each per ES index is seen as a "sane" or reasonable default. Although initially only one instance of Elasticsearch runs on a single machine, Elasticsearch is most commonly used as a cluster.

Over the years I have ran anywhere from 1 to 5 instances of Elasticsearch on the same machines, depending on the hardware. And anywhere from 4 to 20 machines per cluster...

Thanks. Do you have any idea how it created multiple nodes on same machine. You can see in below output there are multiple node directory in data folder. When I freshly installed there was only one. Later I restarted elastic search service and some how it created three nodes

root@KibanaServer:/var/lib/elasticsearch/elasticsearch/nodes# ls -l
total 16
drwxr-xr-x 4 elasticsearch elasticsearch 4096 Feb 27 15:16 0
drwxr-xr-x 4 elasticsearch elasticsearch 4096 Feb 25 15:55 1
drwxr-xr-x 4 elasticsearch elasticsearch 4096 Feb 25 15:55 2
drwxr-xr-x 4 elasticsearch elasticsearch 4096 Feb 25 15:55 3

I have restarted service again and it created only one node.

It's because you started the process multiple time.
In more recent versions, such as 5.x and 6.x, you can not do that by mistake again.

To answer your question, when you start an elasticsearch process, only one node is created.

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