Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Choosing configuration file to start elastic cluster

I have two-node cluster on one machine and one config file (elasticsearch.yml). Is it possible to create another .yml-config file and start every instance with different config-file? For example, i want run cluster on two ports (localhost:9200 and localhost:9201) on the same time.

I can't find command-line API for starting elastic-cluster (config-file as an argument?).

like image 275
Dmitry Lovermann Avatar asked Dec 08 '22 21:12

Dmitry Lovermann


2 Answers

You should be able to start your second ES instance with the -Epath.conf setting on the command line and point to another folder where you have your second elasticsearch.yml configuration file

./bin/elasticsearch -Epath.conf=/path/to/my/second/config/
like image 164
Val Avatar answered Feb 16 '23 07:02

Val


A newer approach starting from ES 6 release for launching multiple instances based on the same ES installation is to have multiple config folders and declaring path variable before startup execution

ES_PATH_CONF=/apps/my-es/conf/node-1 ./elasticsearch
ES_PATH_CONF=/apps/my-es/conf/node-2 ./elasticsearch

To launch as daemon include -d and -p <pidName> for defining pid name

ES_PATH_CONF=/apps/my-es/conf/node-1 ./elasticsearch -d -p es_node1_pid
ES_PATH_CONF=/apps/my-es/conf/node-2 ./elasticsearch -d -p es_node2_pid

here is a reference on ES docs: https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html

like image 34
Vlad Avatar answered Feb 16 '23 08:02

Vlad