Last active
August 29, 2015 14:10
-
-
Save tomoemon/4f1042f8fccf02efd52a to your computer and use it in GitHub Desktop.
Elasticsearch startup script on GCE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install java | |
apt-get update | |
apt-get -y install openjdk-7-jre-headless | |
# install elasticsearch | |
VERSION="1.4.2" | |
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-$VERSION.tar.gz -O /tmp/elasticsearch-$VERSION.tar.gz | |
tar zxvf /tmp/elasticsearch-$VERSION.tar.gz -C /usr/local/ | |
ln -s /usr/local/elasticsearch-$VERSION /usr/local/elasticsearch | |
cd /usr/local/elasticsearch | |
bin/plugin install mobz/elasticsearch-head | |
bin/plugin install elasticsearch/elasticsearch-cloud-gce/2.4.1 | |
# setting elasticsearch | |
PROJECT_ID=$(curl http://metadata/computeMetadata/v1/project/project-id -H "Metadata-Flavor: Google") | |
ZONE=$(curl http://metadata/computeMetadata/v1/instance/zone -H "Metadata-Flavor: Google" | cut -d"/" -f 4) | |
echo " | |
cluster.name: gce-elasticsearch # SET YOUR CLUSTER NAME | |
cloud: | |
gce: | |
project_id: $PROJECT_ID | |
zone: $ZONE | |
discovery: | |
type: gce | |
" >> config/elasticsearch.yml | |
# start elasticsearch | |
bin/elasticsearch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment