-
-
Save jbu/4537943 to your computer and use it in GitHub Desktop.
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
cd ~ | |
sudo apt-get update | |
sudo apt-get install language-pack-en -y | |
sudo apt-get install openjdk-7-jre-headless -y | |
sudo useradd --home /home/elasticsearch --create-home --shell /bin/sh elasticsearch | |
sudo mkdir /home/elasticsearch/lock /var/spool/elasticsearch /var/log/elasticsearch | |
sudo chown -R elasticsearch:elasticsearch /home/elasticsearch/lock /var/spool/elasticsearch /var/log/elasticsearch | |
# Download the compiled elasticsearch rather than the source. | |
wget http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.2.tar.gz -O elasticsearch.tar.gz | |
wget http://github.com/elasticsearch/elasticsearch-servicewrapper/tarball/master -O el-servicewrapper.tar.gz | |
tar -xf elasticsearch.tar.gz | |
mv elasticsearch-* elasticsearch | |
rm elasticsearch.tar.gz | |
tar -xf el-servicewrapper.tar.gz | |
mv *servicewrapper*/service elasticsearch/bin/ | |
rm -Rf *servicewrapper* | |
sudo mv elasticsearch /usr/local | |
cd /usr/local/elasticsearch/config | |
sed -i -e 's_# cluster.name: elasticsearch$_cluster.name: can-elasticsearch_' elasticsearch.yml | |
sed -i -e 's_# path.data: /path/to/data$_path.data: /var/spool/elasticsearch_' elasticsearch.yml | |
sed -i -e 's_# path.logs: /path/to/logs$_path.logs: /var/log/elasticsearch_' elasticsearch.yml | |
/usr/local/elasticsearch/bin/plugin -install elasticsearch/elasticsearch-cloud-aws/1.10.0 | |
echo 'discovery.type: ec2' >> elasticsearch.yml | |
echo 'discovery.ec2.groups: elasticsearch' >> elasticsearch.yml | |
echo 'cloud.aws.access_key: elasticsearch-cluster' >> elasticsearch.yml | |
echo 'cloud.aws.secret_key: kkkkkkk' >> elasticsearch.yml | |
cd /usr/local/elasticsearch/bin/service | |
sed -i -e 's_<Path to ElasticSearch Home>$_/usr/local/elasticsearch_' elasticsearch.conf | |
sed -i -e 's/set.default.ES_HEAP_SIZE=1024/set.default.ES_HEAP_SIZE=256/' elasticsearch.conf | |
sed -i -e 's_/var/lock/subsys_/home/elasticsearch/lock_' elasticsearch | |
sed -i -e 's/#RUN_AS_USER=$/RUN_AS_USER=elasticsearch/' elasticsearch | |
cd ~ | |
sudo chown -R elasticsearch:elasticsearch /usr/local/elasticsearch | |
echo "echo 'elasticsearch soft nofile 32000' >> /etc/security/limits.conf" > set-limits.sh | |
echo "echo 'elasticsearch hard nofile 32000' >> /etc/security/limits.conf" >> set-limits.sh | |
chmod +x set-limits.sh | |
sudo ./set-limits.sh | |
sudo /usr/local/elasticsearch/bin/service/elasticsearch install | |
sudo ln -s `readlink -f /usr/local/elasticsearch/bin/service/elasticsearch` /usr/local/bin/rcelasticsearch | |
sudo service elasticsearch start | |
#curl http://localhost:9200 to test | |
#Thanks to <clintongormley> from #elasticsearch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment