ElasticSearch

  1. Install Elasticsearch 5.6:
    1. sudo apt install openjdk-8-jre-headless
    2. 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
    3. Follow the instructions at https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html#deb-running-systemd
  2. 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
  3. 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