在一个Ubuntu-Server上运行多个elasticsearch节点作为服务

use*_*172 6 ubuntu service nodes elasticsearch

我有一台服务器运行Ubuntu 14.04,220 GB的内存,我想运行elasticsearch.根据文档,一个节点不应该有超过32 GB的RAM,所以我想我必须在这台机器上运行几个节点才能使用所有RAM.我正在考虑为每个节点运行4个节点,内存为28 GB.

如何将其设置为ubuntu服务,以便所有节点在系统重启后自动恢复,例如?我想我必须以某种方式编辑/etc/init.d/elasticsearch - 任何人都可以帮助我吗?

非常感谢你们!

use*_*172 3

一段时间后我放弃了,删除了elasticsearch repo安装并下载了zip文件。然后我创建了两个新贵工作,到目前为止一切都很顺利。

  1. 包装纸

    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
Run Code Online (Sandbox Code Playgroud)
  1. 实例

    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
Run Code Online (Sandbox Code Playgroud)