在一个Ubuntu-Server上运行多个弹性搜索节点作为服务 [英] Run multiple elasticsearch nodes as a service on one Ubuntu-Server

查看:214
本文介绍了在一个Ubuntu-Server上运行多个弹性搜索节点作为服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



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



谢谢你们这么多!

解决方案

一段时间,取消了弹性搜索的安装并下载了zip文件。然后,我创建了两个upstart工作,并且everythings工作顺利到目前为止。


  1. Wrapper



  
description一次启动几个ES实例(这是一个包装器)。

开始(本地文件系统和net-device-up IFACE!= lo)
停止在运行级别[06]
respawn

#给如果在120​​秒内重新启动5次,则重新启动
respawn limit 5 120

env NUM_INSTANCES = 4

预启动脚本
(seq 1 $ NUM_INSTANCES)
do
start elasticsearch-instance ID = $ i
done
end script

预停脚本
curl -XPOSThttp:// localhost:9200 / _cluster / nodes / _local / _shutdown
end script







  1. 实例



  
描述启动弹性搜索实例(节点)

停止弹性搜索
respawn

instance $ ID

limit nofile 64000 64000

setuid elasticsearch
setgid elasticsearch

env JAVA_OPTS = - XX:+ UseCom pressOops
env ES_HEAP_SIZE = 28G
exec / data / elasticsearch / bin / elasticsearch -Des.config = / data / elasticsearch / config / elasticsearch.yml
/ pre>

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

How do I set this up as an ubuntu service, so that all of the nodes automatically come back up after a system reboot for example? I guess I have to edit /etc/init.d/elasticsearch in some way - can anyone help me out?

Thank you guys so much!

解决方案

I gave up after a while, removed the elasticsearch repo-installation and downloaded the zip-file instead. Then I created two upstart-jobs and everythings works smoothly so far.

  1. 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

这篇关于在一个Ubuntu-Server上运行多个弹性搜索节点作为服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆