Run multiple nodes on one machine

(Mockiemockiz) #1

Hi, I'm learning elasticsearch and trying to run multiple nodes or 2 services of elasticsearch. the both work smoothly but the both use the same config file even I already point the another one to use different config file.

this is the output of node info:

as you can see above (the gist link) :

"config.ignore_system_properties": "true",
"config": "/etc/elasticsearch/elasticsearch1.yml",

but it seems the node ignores /etc/elasticsearch/elasticsearch1.yml file and keep using /etc/elasticsearch/elasticsearch.yml.


and please take a look for these code/output:

I'm using ubuntu 14.04 LTS

Multiple ES on one node
(Mark Walkom) #2

Try adding set -x to the top of the script and it'll provide some level of debugging, then you can see if your $NODE variable is being correctly set.

(Mockiemockiz) #3

ooh i forgot to tell you I already debug it and this is the output

start-stop-daemon --start -b --user "elasticsearch" -c "elasticsearch" --pidfile "/var/run/" --exec
/usr/share/elasticsearch/bin/elasticsearch -- -d -p /var/run/ --

(Mark Walkom) #4

Looking at the _nodes output;

  "config.ignore_system_properties": "true",
  "config": "/etc/elasticsearch/elasticsearch.yml",


  "config.ignore_system_properties": "true",
  "config": "/etc/elasticsearch/elasticsearch1.yml",

They appear to be different?

(Mockiemockiz) #5

is it because I run two instance of elasticsearch?

  1. sudo service elasticsearch start which is use /etc/elasticsearch/elasticsearch.yml config

  2. sudo service elasticsearch1 start which is use /etc/elasticsearch/elasticsearch1.yml config

they appear different but when I open localhost:9200/plugin/_head it tell me the both have the same name "Node client balancer" (read from /etc/elasticsearch/elasticsearch.yml and ignore /etc/elasticsearch/elasticsearch1.yml).

but when I click the second node info, it show up like this

Hello I edited my question and I added some links to the files

(Mockiemockiz) #6

so sad this forum is a bit quiet. I solved my proble by setting up ES_JAVA_OPTS variable in init.d file script like this:


I have no idea why setting up CONF_FILE=$CONF_DIR/elasticsearch1.yml doesn't work even if the node info says

"config": "/etc/elasticsearch/elasticsearch1.yml".

hope that helps I was struggling one week to solve this.

(Jason Bryan) #7

Thank you for posting the solution. Configuring '-Des.config=/path/to/es/config' is the way.

(system) #8