Run multiple elasticsearch service on ubuntu -
i'm trying run multiple nodes on pc (ubuntu) learning purpose. try copy /etc/init.d/elasticsearch
, rename etc/init.d/elasticsearch1
. both nodes run succesfully seems both use same config etc/elasticsearch/elasticsearch.yml
not /etc/elasticsearch/elasticsearch1.yml
.
here elasticsearch1 init.d file (since file has no extension, did call right?) :
https://gist.github.com/anonymous/0b8e21b46909b46f2cab
and debug result sudo service elasticsearch1 start
:
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
in debug result, config path correct config file want. idea why both nodes use same config?
if using newer version of ubuntu suspect systemd being used, runs services in different context. therefore node variable overlooked. have @ example https://serverfault.com/questions/413397/how-to-set-environment-variable-in-systemd-service how set environment variables systemd.
for complete details, see fedora's documentation on how write systemd script.
Comments
Post a Comment