Running multiple elasticsearch nodes as a service on a single Ubuntu server

I have a server running Ubuntu 14.04 with 220 GB of RAM on which I would like to run elasticsearch. According to the documentation, one node should not have more than 32 GB of RAM, so I think I need to run several nodes on this machine in order to use all this RAM. I am considering running 4 nodes with 28 GB of memory for each.

How to configure this as an ubuntu service so that all nodes automatically return after a system reboot, for example? I think I need to somehow edit /etc/init.d/elasticsearch - can someone help me?

Thanks guys so much!

+5
source share
2 answers

After some time, I gave up, removed the elasticsearch repo installation, and instead downloaded the zip file. Then I created two upstarts and everything still works.

  • Wrapper
description "Start several ES-instances at once (this is a wrapper)." start on (local-filesystems and net-device-up IFACE!=lo) stop on runlevel [06] respawn # Give up respawn if restart occurs 5 times in 120 seconds respawn limit 5 120 env NUM_INSTANCES=4 pre-start script for i in $(seq 1 $NUM_INSTANCES) do start elasticsearch-instance ID=$i done end script pre-stop script curl -XPOST "http://localhost:9200/_cluster/nodes/_local/_shutdown" end script 

  1. Instances
 description "starts up an elasticsearch instance (node)" stop on stopping elasticsearch respawn instance $ID limit nofile 64000 64000 setuid elasticsearch setgid elasticsearch env JAVA_OPTS="-XX:+UseCompressedOops" env ES_HEAP_SIZE=28G exec /data/elasticsearch/bin/elasticsearch -Des.config=/data/elasticsearch/config/elasticsearch.yml 
+3
source

Assuming your rpm or deb has created an init.d script to run the second node on the same machine, follow these steps:

 cd /etc/init.d cp --preserve elasticsearch elasticsearch2 

Change elasticsearch2 script:

  • change # elasticsearch to # elasticsearch2
  • add node = "2" after the line prog = "elasticsearch"
  • change pidfile = / var / run / elasticsearch / $ {prog}. pid to pidfile = / var / run / elasticsearch / $ {prog} $ {node}. pid
  • change lockfile = / var / lock / subsys / $ prog to lockfile = / var / lock / subsys / $ prog $ node
  • change echo -n $ "Run $ prog:" to echo -n $ "Run $ prog: (node ​​$ node)"
  • change echo -n $ "Stop $ prog:" for echo -n $ "Stop $ prog: (node ​​$ node)"

Save the file. Run

 chkconfig --add elasticsearch2 service elasticsearch2 start 
+2
source

Source: https://habr.com/ru/post/1203869/


All Articles