Skip to content

Instantly share code, notes, and snippets.

@Iristyle
Forked from jaytaylor/etc-init-elasticsearch.conf
Created November 13, 2012 01:28
Show Gist options
  • Save Iristyle/4063289 to your computer and use it in GitHub Desktop.
Save Iristyle/4063289 to your computer and use it in GitHub Desktop.
Ubuntu upstart service script for ElasticSearch on EC2 Large instance
# ElasticSearch Service
description "ElasticSearch"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [016]
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
console output
script
#export ES_HEAP_SIZE='3000m'
# NB: As a general rule of thumb, the amount of memory
# allocated here should not exceed 60% of what is available
# on the system. This allows us to take advantage of the
# OS's caching mechanisms.
export ES_MIN_MEM='4500m'
export ES_MAX_MEM=$ES_MIN_MEM
export ES_HOME="/usr/share/elasticsearch"
DAEMON="${ES_HOME}/bin/elasticsearch"
CONFIG_DIR="${ES_HOME}/config"
LOG_DIR="${ES_HOME}/logs"
DATA_DIR="${ES_HOME}/data"
sudo -E -u ubuntu ${DAEMON} -f -Des.path.conf=${CONFIG_DIR} -Des.path.home=${ES_HOME} -Des.path.logs=${LOG_DIR} -Des.path.data=${DATA_DIR}
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment