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

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

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

非常感谢你们!

解答

一段时间后我放弃了,删除了 elasticsearch repo-installation 并下载了 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

  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
Logo

欢迎大家访问Elastic 中国社区。由Elastic 资深布道师,Elastic 认证工程师,认证分析师,认证可观测性工程师运营管理。

更多推荐