Skip to content

Instantly share code, notes, and snippets.

@sbuljat
Last active January 20, 2017 14:39
Show Gist options
  • Save sbuljat/afdc3d17d90e1b17491db41077a174e3 to your computer and use it in GitHub Desktop.
Save sbuljat/afdc3d17d90e1b17491db41077a174e3 to your computer and use it in GitHub Desktop.

Prepare AWS

  • Create "default-elasticsearch" security group with following Inbound rules:
    • 22/TCP to 0.0.0.0 or private ip
    • 9200/TCP to {public IPs of all nodes in cluster}
    • 9300/TCP to {public IPs of all nodes in cluster}
  • Create instance with security group "default-elasticsearch"

Install ElasticSearch 2.4.4 on Amazon Linux

$ sudo yum -y install java-1.8.0-openjdk-devel.x86_64
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javac
$ sudo wget https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/rpm/elasticsearch/2.4.4/elasticsearch-2.4.4.rpm
$ sudo rpm -ivh elasticsearch-2.4.4.rpm 
$ sudo chkconfig --add elasticsearch
$ sudo /usr/share/elasticsearch/bin/plugin install mobz/elasticsearch-head
$ sudo /usr/share/elasticsearch/bin/plugin install cloud-aws

Setup ElasticSearch Cluster

$ sudo service elasticsearch stop

$ sudo vi /etc/elasticsearch/elasticsearch.yml
  > cluster.name: {Cluster Name}
  > node.name: {Node Name}
  > network.host: 0.0.0.0
  > discovery.zen.ping.multicast.enabled: false
  > discovery.zen.ping.unicast.hosts: [{EC2 Hostnames}]

$ sudo vi /etc/sysconfig/elasticsearch
  > ES_HEAP_SIZE={%50 RAM}g
  
$ sudo service elasticsearch start

$ tail -f /var/log/elasticsearch/{cluster-name}.log

$ curl localhost:9200/_cluster/health?pretty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment