Skip to content

Instantly share code, notes, and snippets.

@jaytaylor
Last active July 8, 2018 22:06
Show Gist options
  • Save jaytaylor/3494886 to your computer and use it in GitHub Desktop.
Save jaytaylor/3494886 to your computer and use it in GitHub Desktop.
Ubuntu upstart service script for ElasticSearch on EC2 Large instance
# ElasticSearch upstart script
description "ElasticSearch service"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [016]
respawn
respawn limit 10 30
# 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="/opt/sendhub/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