Run multiple nodes on one machine

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.

/etc/init.d/elasticsearch1

and please take a look for these code/output:

I'm using ubuntu 14.04 LTS

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.

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/elasticsearch1.pid" --exec
/usr/share/elasticsearch/bin/elasticsearch -- -d -p /var/run/elasticsearch1.pid --
default.config=/etc/elasticsearch/elasticsearch1.yml
--default.path.home=/usr/share/elasticsearch
--default.path.logs=/var/log/elasticsearch1
--default.path.data=/var/lib/elasticsearch1
--default.path.work=/tmp/elasticsearch
--default.path.conf=/etc/elasticsearch

Looking at the _nodes output;

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

And;

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

They appear to be different?

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 https://gist.github.com/mockiemockiz/738f7b81ec5099b3d8f6

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

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:

ES_JAVA_OPTS="-Des.config=/etc/elasticsearch/elasticsearch1.yml"

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.

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