Skip to content

Instantly share code, notes, and snippets.

@aliakhtar
Created February 20, 2016 21:01
Show Gist options
  • Save aliakhtar/cd57ede55db98d728af8 to your computer and use it in GitHub Desktop.
Save aliakhtar/cd57ede55db98d728af8 to your computer and use it in GitHub Desktop.
#!/bin/sh
#Installs ElasticSearch. Expects that jdk is not installed on the server.
#Before starting, make a directory in /mnt/es and sudo chmod 666 /mnt/es (r+w)
#See https://gist.github.com/aliakhtar/c74b4cb0c8dfa95ebf4a for jdk.sh
./jdk.sh
wget https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/2.2.0/elasticsearch-2.2.0.deb
sudo dpkg -i elastic*.deb
rm -f elastic*.deb
sudo update-rc.d elasticsearch defaults 95 10
sudo swapoff --all
echo "INFORMATION:"
echo "Make sure the IO scheduler is using noop or deadline if usign SSD."
echo "For an array of SSDs, use noop, for a single SSD, use deadline."
echo "To check, run: cat /sys/block/xvdb/queue/scheduler (replacing xvdb with id of your ssd (from lsblk )"
echo "Settings to change in /etc/default/elasticsearch : \n"
echo "ES_HEAP_SIZE=3500m" #don't use 3.5g, it cannot handle decimals
echo "MAX_LOCKED_MEMORY=unlimited"
echo "DATA_DIR=/mnt/es"
echo "CONF_FILE=/etc/elasticsearch/elasticsearch.yml"
echo "Settings to change in /etc/elasticsearch/elasticsearch.yml : \n"
echo "cluster.name: Your_Cluster"
echo "To start: sudo service elasticsearch start"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment