Skip to content

Instantly share code, notes, and snippets.

@killtw
Last active June 14, 2016 06:23
Show Gist options
  • Save killtw/b985b1180dce6d41e7f1 to your computer and use it in GitHub Desktop.
Save killtw/b985b1180dce6d41e7f1 to your computer and use it in GitHub Desktop.

Revisions

  1. killtw revised this gist Jun 14, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion elasticsearch.sh
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    echo ">>> Installing Elasticsearch"

    # Set some variables
    ELASTICSEARCH_VERSION=2.1.1 # Check https://www.elastic.co/downloads/elasticsearch for latest version
    ELASTICSEARCH_VERSION=2.3.3 # Check https://www.elastic.co/downloads/elasticsearch for latest version

    # Install prerequisite: Java
    # -qq implies -y --force-yes
  2. killtw created this gist Feb 1, 2016.
    25 changes: 25 additions & 0 deletions elasticsearch.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    #!/usr/bin/env bash

    echo ">>> Installing Elasticsearch"

    # Set some variables
    ELASTICSEARCH_VERSION=2.1.1 # Check https://www.elastic.co/downloads/elasticsearch for latest version

    # Install prerequisite: Java
    # -qq implies -y --force-yes
    sudo apt-get update
    sudo apt-get install -qq openjdk-7-jre-headless

    wget --quiet https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-$ELASTICSEARCH_VERSION.deb
    sudo dpkg -i elasticsearch-$ELASTICSEARCH_VERSION.deb
    rm elasticsearch-$ELASTICSEARCH_VERSION.deb

    # Configure Elasticsearch for development purposes (1 shard/no replicas, don't allow it to swap at all if it can run without swapping)
    sudo sed -i "s/# index.number_of_shards: 1/index.number_of_shards: 1/" /etc/elasticsearch/elasticsearch.yml
    sudo sed -i "s/# index.number_of_replicas: 0/index.number_of_replicas: 0/" /etc/elasticsearch/elasticsearch.yml
    sudo sed -i "s/# bootstrap.mlockall: true/bootstrap.mlockall: true/" /etc/elasticsearch/elasticsearch.yml
    sudo sed -i "s/# network.host: 192.168.0.1/network.host: 192.168.10.10/" /etc/elasticsearch/elasticsearch.yml
    sudo service elasticsearch restart

    # Configure to start up Elasticsearch automatically
    sudo update-rc.d elasticsearch defaults 95 10