ElasticSearch
- Install Elasticsearch 5.6:
- sudo apt install openjdk-8-jre-headless
- Follow the instructions at https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html making sure to substitute the version numbers with 5.6
- Follow the instructions at https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html#deb-running-systemd
- Configure it to use 1GB heap size (by default, it’s 2GB). This will help minimise memory issues:
# nano /etc/elasticsearch/jvm.options
-Xms1g
-Xmx1g - Install custom script to restart elastic search when it’s down. Then add it as a cron job to run every minute:
# ~/superviseElasticSearch.sh
PATH=/usr/sbin:/usr/bin:/sbin:/bin
ps -ef | grep elasticsearch | grep -v grep
if [ ! $? -eq "0" ]; then
service elasticsearch start
fi
#crontab -e
* * * * * bash ~/superviseElasticSearch.sh