Skip to content

Instantly share code, notes, and snippets.

@observerss
Forked from jaytaylor/etc-init-elasticsearch.conf
Last active December 19, 2015 19:19
Show Gist options
  • Save observerss/6005322 to your computer and use it in GitHub Desktop.
Save observerss/6005322 to your computer and use it in GitHub Desktop.
elasticsearch upstart script for official deb packages (tested with 0.90.2)
# ElasticSearch Service
description "ElasticSearch"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [016]
respawn
respawn limit 10 5
# NB: Upstart scripts do not respect
# /etc/security/limits.conf, so the open-file limits
# settings need to be applied here.
limit nofile 32000 32000
env ES_HOME=/usr/share/elasticsearch
env ES_MIN_MEM=2g
env ES_MAX_MEM=2g
env ES_HEAP_SIZE=2g
env DAEMON="${ES_HOME}/bin/elasticsearch"
env DATA_DIR=/var/lib/elasticsearch
env CONFIG_DIR=/etc/elasticsearch
env LOG_DIR=/var/log/elasticsearch
env WORK_DIR="$ES_HOME"
console output
script
if [ -f /etc/default/elasticsearch ]; then
. /etc/default/elasticsearch
fi
su -s /bin/dash -c "$DAEMON -f -Des.path.conf=$CONFIG_DIR -Des.path.home=$ES_HOME -Des.path.logs=$LOG_DIR -Des.path.data=$DATA_DIR -Des.path.work=$WORK_DIR" elasticsearch
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment