Create multiple nodes elasticsearch 5.4

Hello

i want to create multiple nodes in single cluster in the single server

what steps i need to follow

i try many but not success yet

i am using elasticsearch 5.4

At minimum, each node needs to be configured to have the same cluster name, and the unicast discovery list must include the addresses of the other nodes.

See the important settings docs here: https://www.elastic.co/guide/en/elasticsearch/reference/current/important-settings.html

Once those are configured, you can just turn on the nodes and they will find each other and cluster.

I have tried both way

way 1

path:
data: ["/usr/share/elasticsearch/data/nodes/node_1","/usr/share/elasticsearch/data/nodes/node_2","/usr/share/elasticsearch/data/nodes/node_3"]
logs: ["/var/log/elasticsearch/nodes/node_1","/var/log/elasticsearch/nodes/node_2","/var/log/elasticsearch/nodes/node_3"]

cluster.name: search

node.name: node_1

node.max_local_storage_nodes: 1

bootstrap.memory_lock: true

network.host: 192.168.0.1

http.port: 9200

discovery.zen.ping.unicast.hosts: ["192.168.0.1:9200","192.168.0.2:9200","192.168.0.3:9200"]

discovery.zen.minimum_master_nodes: 2

way 2

path:
data:

  • /usr/share/elasticsearch/data/nodes/node_1
  • /usr/share/elasticsearch/data/nodes/node_2
  • /usr/share/elasticsearch/data/nodes/node_3
    logs:
  • /var/log/elasticsearch/nodes/node_1
  • /var/log/elasticsearch/nodes/node_2
  • /var/log/elasticsearch/nodes/node_3

cluster.name: search

node.name: node_1

node.max_local_storage_nodes: 1

bootstrap.memory_lock: true

network.host: 192.168.0.1

http.port: 9200

discovery.zen.ping.unicast.hosts:

  • 192.168.0.1:9200
  • 192.168.0.2:9200
  • 192.168.0.3:9200

discovery.zen.minimum_master_nodes: 2

but still not working can you please let me know what i am doing wrong here

when i run this

bash -x bin/elasticsearch

then get this error

 org.elasticsearch.bootstrap.StartupException: java.lang.IllegalArgumentException: unknown setting [path.logs.0] did you mean [path.logs]?

Suppressed: java.lang.IllegalArgumentException: unknown setting [path.logs.1] did you mean [path.logs]?

Suppressed: java.lang.IllegalArgumentException: unknown setting [path.logs.2] did you mean [path.logs]?

Hello i solved this error via providing the log path as string

now this is error

  org.elasticsearch.bootstrap.StartupException: BindTransportException[Failed to bind to [9300-9400]]; nested: BindException[Cannot assign requested address];

Caused by: java.net.BindException: Cannot assign requested address

this is my configuration

discovery.zen.ping.unicast.hosts:

  • 192.168.0.1:9200
  • 192.168.0.2:9200
  • 192.168.0.3:9200

If you want to start multiple nodes on the same machine (for tests purposes) just run:

bin/elasticsearch -Epath.data=data1 -Epath.logs=log1
bin/elasticsearch -Epath.data=data2 -Epath.logs=log2
bin/elasticsearch -Epath.data=data3 -Epath.logs=log3

Without changing anything in the default elasticsearch.yml and you should be done.

1 Like

so i not need to define
discovery.zen.ping.unicast.hosts:

Hello

i have tried your command as well

but this error come everytime

 not enough master nodes discovered during pinging (found [[Candidate{node={node_1}{MG8J5dsmTVSIiRdmz3BrSg}{9RlgCikaTPW8vOIjynaEqQ}{127.0.0.1}{127.0.0.1:9304}, clusterStateVersion=-1}]], but needed [3]), pinging again

Did you comment all the settings in elasticsearch.yml?

path:
data: /usr/share/elasticsearch/data/node_1
logs: /var/log/elasticsearch/node_1

cluster.name: search

node.name: node_1
#node.master: true ( commented )
node.data: true
node.max_local_storage_nodes: 1
bootstrap.memory_lock: true
network.host: local

#discovery.zen.ping.unicast.hosts: ( commented )

- 192.168.0.1:9200 ( commented )

- 192.168.0.2:9200 ( commented )

- 192.168.0.3:9200 ( commented )

#discovery.zen.minimum_master_nodes: 10 ( commented )

but not working even when i run

bin/elasticsearch -Epath.data=/usr/share/elasticsearch/data/node_2 -Epath.logs=/var/log/elasticsearch/node_2

then even service not start for Query API

and how to define the name of the node via command line

can you guide the step and let me know if anything need to change and comment

i am also facing issue

max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

i have changed in

sudo nano /usr/lib/systemd/system/elasticsearch.service

sudo nano /etc/sysconfig/elasticsearch

sudo nano /etc/security/limits.conf

all three places but error is coming

also see this

ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 15090
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 65536
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 15090
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

what is else need to do

Hello

when you run bin/elasticsearch then there are some errors

if you solve all errors then it's working fine

to add new node in the cluster

thanks
jayram

I am able to run 3 nodes on same server with same setup and with 3 different config files/folders sharing common cluster name

node-0: default node, config file path: ${ES_HOME}/config (no changes in elasticsearch.yml file)

node-1: 1st extra node, config file path: ${ES_HOME}/config/config_node1

node-2: 2nd extra node, config file path: ${ES_HOME}/config/config_node2

Below are the changes I made in elasticsearch.yml node1 and node2

elasticsearch.yml for node-1

node.name: node-1
path.data: ${ES_HOME}/data_node1
path.logs: ${ES_HOME}/logs/logs_node1
http.port: 9201

elasticsearch.yml for node-2

node.name: node-2
path.data: ${ES_HOME}/data_node2
path.logs: ${ES_HOME}/logs/logs_node2
http.port: 9202

command for starting all 3 nodes
node-0 (it will take default config folder,no need to specify)

elasticsearch.bat

node-1

elasticsearch.bat -Epath.conf=${ES_HOME}/config/config_node1

node-2

elasticsearch.bat -Epath.conf=${ES_HOME}/config/config_node2

All 3 nodes are running fine verified in ElasticHQ too

Hello i have tried your code

this error occurred for me

ERROR: no log4j2.properties found; tried [/etc/elasticsearch/nodes/node_2.yml] and its subdirectories

can you let me know what is your directory structure with file names

i am using elasticsearch5.4

I have put two separate log4j2.properties and jvm.option file in both config folder

and for log4j2.properties it will take it from config folder automatically

for jvm.option file please check this post -

which version on elasticsearch you are using

i am on 5.4 and that's not working for me

I am also running 5.4.0

Try to start all instances by opening the new cmd prompt and before starting each node set ES_JVM_OPTIONS in path, and also pass for path.conf excluding for master node which doesn't require ES_JVM_OPTIONS and path.conf to be set/passed

for starting node1

set ES_JVM_OPTIONS=d:/uat/elasticsearch540/config_node1/jvm.options
elasticsearch.bat -Epath.conf=${ES_HOME}/config_node1

for starting node2

set ES_JVM_OPTIONS=d:/uat/elasticsearch540/config_node2/jvm.options
elasticsearch.bat -Epath.conf=${ES_HOME}/config_node2

ES_JVM_OPTIONS is used by elasticsearch.bat and the path specified in path.conf will be used for reading elasticsearch.yml and log4j properties file.

I am running 3 nodes perfectly fine.

i added three node via command

but when i reboot the server then only master is there other are left

do you have any suggestion about that

That's the same thread as

No need to discuss this in multiple places.

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