Skip to content

Instantly share code, notes, and snippets.

@duydo
Created September 15, 2012 15:25
Show Gist options
  • Save duydo/3728456 to your computer and use it in GitHub Desktop.
Save duydo/3728456 to your computer and use it in GitHub Desktop.
elasticsearch script
#!/bin/bash
NAME=elasticsearch
PREFIX=/usr/local
ES_HOME=$PREFIX/$NAME
install() {
v=$1;
echo "Downloading $NAME $v...";
file="$NAME-$v.tar.gz";
wget -c "https://github.com/downloads/elasticsearch/elasticsearch/$file";
echo "Downloaded";
echo "Extracting $file..."
tar xfvz $file -C $PREFIX
echo "Extracted"
echo "Create a link $PREFIX/$NAME-$v --> $PREFIX/$NAME"
ln -sfn $PREFIX/$NAME-$v $PREFIX/$NAME
echo "Installing elasticsearch-head plugin...";
$PREFIX/$NAME/bin/plugin -install mobz/elasticsearch-head
echo "Cleaning..."
rm -f $file;
echo "DONE";
}
remove() {
echo 'NOT SUPPORTED YET';
}
start() {
$ES_HOME/bin/elasticsearch -f -Des.path.logs=$HOME/.$NAME/logs -Des.path.data=$HOME/.$NAME/data
}
case "$1" in
install)
install $2
;;
remove)
remove
;;
start)
start
;;
*)
echo "$1 is not supported."
echo "Usage: $0 {install|remove|start}"
exit 3
esac
exit 0
This is quick and dirty script to install elasticsearch.
Usage:
Install: elasticsearch install <version>
Start: elasticsearch start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment