Saturday, 13 February 2016

Elasticsearch EC2 Autoscaled Implementation

Elasticsearch has now superseded Solr as the defacto search server. Both systems have Lucene at the heart, Elastic has various benefits and features above Solr but this post will focus on implementing a scaleable search service cluster on an AWS. In a previous post I outlined a similar solution for a SolrCloud cluster. Although this is robust it isn't truly scaleable because each instance needs to be preconfigured to have reference to the other. It may be possible to get around this, inject configuration at runtime and autoscale the cluster. However, Elasticsearch makes this very easy to do directly out of the box and create a stateless, highly scalable search service cluster in a fraction of the time.

Amazon offers two search systems as Platform as a Service: CloudSearch and Elasticsearch Service. Unsurprisingly, these are essentially SolrCloud and Elasticsearch implemented on EC2 behind the scenes and offered as a service. Of course there are advantages to using these but if you want complete control over your search cluster implementation and functionality then you need to build your own from the ground up. The good news is that this is very simple but there are some stumbling blocks which are not obvious in any documentation I've come across.

Setting up the Environment


Before getting into the Elasticsearch configuration we need to focus on the environment. You will probably already have your own VPC and network configuration for Dev, Test and Production. The cluster is a simple set up; Elasticsearch instances running in each availability zone behind a load balancer serving HTTP requests. Each instance needs to know about the other in the cluster and this is done by automatic discovery. Each instance must be associated to the same security group which is used to control access and importantly for filtering discovered instances on the same network. This will be covered later.

Autoscaled cross availability zone Elasticsearch EC2 instances with associated volumes 


Elasticsearch instances will, by default, be capable of automatically discovering each other and forming a dynamic cluster. This is accomplished using network multicast. However, this is disabled in AWS and most other cloud hosts and prevents Elasticsearch from clustering out of the box. To create the cluster we must install the Cloud-aws plugin which utilizes the AWS-API for unicast discovery of other Elasticsearch instances on the network. In order to use this we must provide IAM account credentials in our Elasticsearch configuration file. The account must have permission to use the EC2 service by granting - ec2:DescribeInstances

Installing Elasticsearch from the Package Manager


Once happy with the network setup we can begin building out the temporary instance which will be used to form the baseline image. Many of the tutorials and examples I have come across built out on Ubuntu but I decided to go with the initial Amazon Machine Linux baseline. I started a t2.medium instance and added an additional volume of 25Gig. This will be mounted on a path where we will store the indexed data so size is dependent on what you intend to index and how you want to shard it.

The easiest way to install Elasticsearch is from an rpm which can be downloaded the Elastic.co web site and will need to be added to the package manager
Edit the file and add the Elastic repository
Now install Elastic from the package manager, run it as a service and set the JVM heap size as an environment variable. Add the following line, set the heap size to whatever you wish, within the constraints of your desired EC2 instance type -

Installing The AWS Plugin and Configuring Elasticsearch


Now configure Elasticsearch itself. First, install the cloud-aws plugin which is required to enable auto discovery.
Now edit the main elastic yaml config file found in /etc/elasticsearch/elasticsearch.yml With the exception of logging, all settings are configured in this file. The intention is to avoid any predefined state, such as hostnames or IP addresses, which will require any manual intervention at runtime. There are many properties which could be configured here, however the configuration outlined below is enough to get a basic cluster up and running on EC2.
Now start the Elasticsearch service to ensure it boots up and runs on the configuration we have made. By default the logs are set to level INFO, if you edit the logging.yml file prior to starting and set the default level to DEBUG you'll be able to get some more meaningful information out should you come across any problems. When running the server will log to /var/log/elasticsearch/elastic-cluster.log
You should now be able to make client HTTP requests to the running service either from your local browser or the command line and get information about the cluster and nodes. This will report the state of the cluster with a JSON response and should look similar to this

Create the Autoscaled Cluster


Assuming the service starts without a problem you will now have a single instance from where you can create the image which will be used in the launch configuration. Simply image the running instance and name the AMI appropriately.

Create an Elastic Load Balancer, set the ping check to root on port 9200. Add a listener to receive on port 80 and forward to 9200 on the instances. Either create anew security group or use the same one associated to the instance you created earlier. If creating a new one ensure the instance security group has reference to it so that traffic from the load balancer can make contact with the instances. Enable cross Availability Zone balancing so we can ensure the cluster is highly available.

Create the Launch Configuration and associated Autoscaling Group. these are straight forward, the Launch Config should simply instantiate the image we created earlier on a suitable instance type. I chose t2.medium which gives me ample memory to designate the 1 gig heap size I defined in my environment variable. associate the instance security group and create the Autoscaling Group which you can play with to scale as you require. I just set it to maintain a cluster of 3, which should ensure we have at least one instance in each Eu-west zone. If you wish to launch your instances with an associated volume on which to store the search index files then you must specify the volume in the launch configuration and pass the mount command as user data to the launching instance. You should also specify the path.data value in the elasticsearch.yml file with reference to the directory where the volume is mounted.

Once the cluster has initialized you should be able to make another HTTP request to the load balancer and confirm the number of running nodes This will report the state of the cluster with a JSON response and should look similar to this

54 comments:

  1. The Blog gave us idea about Elasticsearch EC2 Autoscaled Implementation my sincere thanks for sharing this post please continue to share this post
    AWS Training in BTM Layout || AWS Training in Marathahalli

    ReplyDelete
  2. Nice article, users are attracted when they see your post thanks for posting keep updating AWS Online Course Bangalore

    ReplyDelete
  3. The content is good and very informative and I personally thank you for sharing article on Elasticsearch.

    ReplyDelete
  4. Thanks for sharing such an informative blog. I have read your blog and I gathered some needful information from your post. Keep update your blog. Awaiting for your next update.
    sap abap online courses

    ReplyDelete

  5. Best institute for 3d Animation and Multimedia Course training Classes

    Best institute for 3d Animation and Multimedia

    Best institute for 3d Animation Course training Classes in Noida- webtrackker Is providing the 3d Animation and Multimedia training in noida with 100% placement supports. for more call - 8802820025.

    3D Animation Training in Noida

    Company Address:

    Webtrackker Technology

    C- 67, Sector- 63, Noida

    Phone: 01204330760, 8802820025

    Email: info@webtrackker.com

    Website: http://webtrackker.com/Best-institute-3dAnimation-Multimedia-Course-training-Classes-in-Noida.php


    Our courses:
    3D Animation and Multimedia Training in Noida.
    3d Multimedia Institute in Noida.
    Animation and Multimedia Training in Noida.
    Animation and Multimedia Training institute in Noida .
    Multimedia Training institute in Noida.
    Multimedia Training classes in Noida.
    3D Animation Training in Noida.
    3D Animation Training institute in Noida.

    ReplyDelete
  6. Sap fico training institute in Noida

    Sap fico training institute in Noida - Webtrackker Technology is IT Company which is providing the web designing, development, mobile application, and sap installation, digital marketing service in Noida, India and out of India. Webtrackker is also providing the sap fico training in Noida with working trainers.


    WEBTRACKKER TECHNOLOGY (P) LTD.
    C - 67, sector- 63, Noida, India.
    F -1 Sector 3 (Near Sector 16 metro station) Noida, India.

    +91 - 8802820025
    0120-433-0760
    0120-4204716
    EMAIL: info@webtrackker.com
    Website: www.webtrackker.com

    ReplyDelete
  7. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...

    datesheet-nic
    Guest posting sites

    ReplyDelete
  8. QuickBooks Payroll has emerged the best accounting software that has had changed the meaning of payroll. Quickbooks Payroll Support contact number is the team that offer you QuickBooks Payroll Support Phone Number

    ReplyDelete
  9. Will you be facing the issue with decision making? The amount of is it possible to earn in a month? You ought to predict this before. Many people are not used to this. We shall help most of the folks. What business are you having? Can it be raw material business? Would you cope with retail trade? Craftsmen also cope with your selection of revenue. Sometimes you do not forecast the specific budget. We now have experienced individuals to provide you with the figure. We're going to also supply you with the figure of your respective budget which you yourself can get in the future from now. This will be only possible with QuickBooks Support Phone Number.

    ReplyDelete
  10. Why you ought to choose QuickBook Support number would be to give you the technical help 24*7 so as with order in order to prevent wasting your productivity hours.

    ReplyDelete
  11. Our QuickBooks Support Phone Number channel- We comprehend the complexity and need making use of this accounting software in day to day life. You can’t look out for just about time for this to have a fix of each single QB error.

    ReplyDelete
  12. QuickBooks Payroll customer service is obtainable and beneficial to many business owners, accountants, CA, CPA to calculate taxes and pay employees. Several types of issues and errors arise the need to contact the Intuit Payroll support team using QuickBooks Payroll Support USA.

    ReplyDelete
  13. Are you wandering every now and then so that you can look for the best way to run the QuickBooks Enterprise software for your needs? We now have come with a lot of permanent approaches to fix your problems in a few seconds with a perfect QuickBooks Payroll Tech Support. Just dial our QuickBooks Enterprise phone number to contact QuickBooks enterprise help team anytime & anywhere.

    ReplyDelete
  14. Accountant: If you handle accounts department of various companies or institutes etc. then QuickBooks Enterprise Support Number industry version is of great use.

    ReplyDelete
  15. If you are a small business owner, you need to be aware of the fact that Payroll calculation does demands large amount of time and man force. Then came into existence QuickBooks Customer Support Number and Quickbooks Payroll Customer Support telephone number team.

    ReplyDelete
  16. Be sure that two QuickBooks Tech Support Number files namely qbw32.exe and qbupdate.exe receives the update access through firewall security software and port 80 and 443 are not disabled.

    ReplyDelete
  17. At QuickBooks Support Phone Number we work on the principle of consumer satisfaction and our effort is directed to give a transparent and customer delight experience.

    ReplyDelete
  18. Each time you dial Support For QuickBooks, your queries get instantly solved. Moreover, you could get in touch with our professional technicians via our email and chat support choices for prompt resolution of all related issues.

    ReplyDelete
  19. QuickBooks Tech Support Number is accounting software, that is a cloud-based application manufactured by Inuit Inc. As a matter of fact, the program happens to be developed using the intention of keeping a secure record of financial needs associated with the business. Additionally, it is a user-friendly accounting software; easy to maintain; assisting the business in order to keep the records of financial transactions, and a whole lot more features.

    ReplyDelete
  20. QuickBooks 6000 series, QuickBooks PS series square measure several of the foremost common and then the most dangerous errors which our Users have to face. therein case, they ought to forthwith dial the fee QuickBooks Tech Support Phone Number.

    ReplyDelete
  21. You can actually resolve this error by using the below troubleshooting steps you are able to simply contact our QuickBooks Help & Support available at.You should run QuickBooks print and pdf repair tool to ascertain and fix the errors in printer settings prior to starting the troubleshooting.

    ReplyDelete
  22. The 2nd principle says that all the QuickBooks Support Phone Number transactions should really be recorded in a single currency. This avoids the loss at the time of inflation and help you keep a crisp business record.

    ReplyDelete
  23. QuickBooks Payroll Support is the greatest platform for small enterprises. QuickBooks Support helps you to run all QuickBooks Payroll services boosting your organization quickly.

    ReplyDelete
  24. Options now contain versions for manufacturers, wholesalers, professional firms, contractors and non-profit entities. And retailers, in adding to one precisely designed for professional accounting firms who service numerous small enterprise clients. In May 2002 Intuit thrown QuickBooks Enterprise Solutions for medium-sized businesses. QuickBooks Enterprise Technical Support Phone Number
    here to produce tech support team to users.

    ReplyDelete
  25. It's simple to get a quantity of benefits with QuickBooks Customer Support Number. Proper analyses are done first. The experts find out from the nature associated with trouble. You'll get a whole knowledge as well. The support specialist will identify the problem. The deep real cause will probably be found out. All the clients are extremely content with us.

    ReplyDelete
  26. Problems are inevitable plus they usually do not come with a bang. Our team at 247 Tech Support Number is ready beforehand to provide you customer-friendly assistance if you speak to an issue using QuickBooks Pro. All of us is skilled, talented, knowledgeable and spontaneous. Without taking most of your time, our team gets you rid of all unavoidable errors of this software.

    ReplyDelete
  27. QuickBooks Payroll Tech Support Number may be the supreme software of accounting for managing the financial health for the business. The trend of this marketplace has modified using its introduction. It offers you the whole image of business insights so that you’ll strategize for future prospective consequently for your needs.

    ReplyDelete
  28. So don’t worry about any of it our excellent QuickBooks Enterprise Support Phone Number team supply you every knowledge about this topic also. Many QuickBooks user always confused about something that which accounting software program is the very best and right choice for their business. So here you are going.

    ReplyDelete
  29. For the betterment, the tax rates. depending on federal and state, are feed in to the QuickBooks Payroll Tech Support Number software. The device can remind the user for the tax payment if a reminder has been set.

    ReplyDelete
  30. Let’s update you because of the undeniable fact that this matter is immensely faced by our customers. Try not to worry after all and call us at our QuickBooks Tech Support Phone Number.

    ReplyDelete
  31. Intuit QuickBooks Support Number helps most of the kinds of businesses with generating accounting reports, entries for every single sale, transactions pertaining to banking, etc., with a lot of ease.

    ReplyDelete
  32. Hey there! Recently I have read your blog on QuickBooks Payroll Error PS038, and I will appreciate your efforts and research for writing such an informative blog. In today’s scenario, bloggers write blogs only to gain followers and popularity, but you have proven them wrong. I hope that you have a successful blogging career ahead. Your solutions were easy to use and 100% working. Anyone can implement these solutions even with low computer and software knowledge. For More information visit our website-QuickBooks Support Phone Number

    ReplyDelete

  33. Thank you for writing blog . I am new to the software and doesn’t know how to encounter error, but your blog has helped me to overcome this error. Your step-by-step solutions for the blog can help anyone with the least technical knowledge. I have gone through other’s blog but none of them was so accurate and informative as yours. After reading this blog, I immediately subscribed to your blogging channel to enjoy the more amazing blog. for more information visit our website-QuickBooks Pro Support Phone Number +1-844-200-2627

    ReplyDelete

  34. Hello Mate!
    Your post is amazingly beautiful! Waiting in anticipation, for some more posts from your side.
    Keep the hard work going, my friend. Point-of-Sale is amazing accounting software that
    flawlessly streamlines your business operation. Apart, from the several benefits, this
    software is also bounded by several errors and glitches. Thus, at any given pint of time if you
    are facing any issues of your software, quickly dial our QuickBooks POS Support Phone Number1-844-235-3996 and instantly get your issues fixed.visit us:-https://tinyurl.com/y53d8baj

    ReplyDelete

  35. Hello Mate!
    Your post is amazingly beautiful! Waiting in anticipation, for some more posts from your side.
    Keep the hard work going, my friend. Point-of-Sale is amazing accounting software that
    flawlessly streamlines your business operation. Apart, from the several benefits, this
    software is also bounded by several errors and glitches. Thus, at any given pint of time if you
    are facing any issues of your software, quickly dial our QuickBooks POS Support Phone Number1-844-235-3996 and instantly get your issues fixed.visit us:-https://tinyurl.com/y53d8baj

    ReplyDelete
  36. Wow! I am truly amazed of your post. I must appreciate your writing style and the way you convince people. In case you are also using QuickBooks enterprise version then you must keep QuickBooks Customer Care +1 833-222-6943 on speed dial. This is because you can call on this toll-free number to get technical help and support for QuickBooks.
    Read More:QuickBooks Error 392

    ReplyDelete
  37. Thanks for sharing this informative blog. Nowadays, it is very rarely found on internet. I am truly a big fan of your writing style and the vocabulary used by you in every content. In case you are looking to get an automated accounting software for your business then QuickBooks can be your perfect choice. Whenever you face any sort of technical difficulty while using the software, feel free to give a call at QuickBooks Pro Support Phone number +1 833-222-6943.
    Read more: QuickBooks Error 15271

    ReplyDelete

  38. Your info is really amazing with impressive content..Excellent blog with informative concept. Really I feel happy to see this useful blog, Thanks for sharing such a nice blog..
    If you are looking for any Big data Hadoop Related information please visit our website Big Data Hadoop Training In Bangalore page!

    ReplyDelete
  39. Once again you have presented such as unique and engaging content. I wonder how you come across such ideas. I appreciate and admire your work and share it with my friends. Hey, you can use QuickBooks for managing important businesses. Check out more about the utility of QuickBooks and the assistance at QuickBooks Support Phone Number 1-833-441-8848.

    ReplyDelete

  40. Wow! I have become a big fan of your writing style and the way you bind readers to read your blog in one go. I eagerly wait for your post on daily basis. In case you are a QuickBooks software user and seeking help for the software then QuickBooks enterprise Support Phone Number +1 833-222-6943 can be the best way to get technical help and support.
    Read More: QuickBooks enterprise reviews: overview, pricing and features

    ReplyDelete
  41. Hi! I have a great fond of reading and loves to read blogs in my free time. One fine day I just bumped into your article and I found it very informative and convincing. One thing I would like to tell you that I am a great fan of yours. QuickBooks is reliable accounting software. All the issues of QuickBooks are resolved at QuickBooks Desktop Support Phone Number 1-833-441-8848.

    ReplyDelete
  42. It has been a long span since I actually had access to such a blog. Keep doing this great work with great spirits and see a hike in the number of readers and subscribers. I would suggest you get all the doubts resolved at Number for QuickBooks POS Support +1 (888) 238-7409. Read more: - https://tinyurl.com/y5pcdh9x & Visit us: - https://www.enetquickbookenterprise.com/quickbooks-pos-support/

    ReplyDelete
  43. Hi, nice information regarding the topic. It’s easy to understand and grab more information when the topic has sufficient content. The best part that grabs my attention was the precise points made by you on your post. Thank you for sharing such a powerful post. Enjoy your life stress-free and even manage the time with QuickBooks. In case, you face any problem, contact QuickBooks customer support phone number +1 833-222-6943 for instant and perfect help.
    Read more:QuickBooks Error Code 6189?

    ReplyDelete
  44. Hey! Great work. I feel so happy to be here reading your post. Do you know QuickBooks Desktop is the leading brand in the accounting world? I have been using this software for the past 3 years. I love the ease of use and the different tools provided by the software. In case you want any help regarding your software then dial QuickBooks Desktop Support Phone Number 1-833-441-8848.

    ReplyDelete
  45. Mind-blowing stuff! Must say this is a great post. Just like QuickBooks which is a great accounting software for accountants and bookkeepers all over the world. However, there are some minor bugs which one can come across with but not to worry as at QuickBooks
    Support Phone Number
    1-833-441-8848 you will get all the solution 24x7 and that too at nominal price. So, call now!

    ReplyDelete
  46. Hey Nice Blog!! Thanks For Sharing!!! Wonderful blog & good post. It is really very helpful to me, waiting for a more new post. Keep Blogging ! Here is the best.

    python Training in chennai

    python Course in chennai


    ReplyDelete
  47. Hey Nice Blog Looking For a Speech & Hearing Clinic: Best center for Hearing Aids, Speech therapy, Cochlear Implants Treatement in Faridabad
    https://local.google.com/place?id=11563476119897538829&use=posts&lpsid=5767387276361974824
    https://www.google.com/maps?cid=11563476119897538829&authuser=2&_ga=2.179766692.164854179.1617794730-617154765.16155339https://www.google.co.in/search?ved=1t:65428&authuser=2&authuser=2&_ga=2.179766692.164854179.1617794730-617154765.1615533922&q=Shravan+Kendra+Speech+%26+Hearing+Clinic&ludocid=11563476119897538829&lsig=AB86z5VKpfQOyvHopi5l_prezJ_M#fpstate=lie22
    https://g.page/shravankendra?gm
    Speech & Hearing Centre Faridabad
    hearing clinic in Faridabad
    Speech & Hearing Centre Faridabad
    best hearing centre near me
    hearing clinic in Faridabad

    ReplyDelete