Downloading and installing ElasticSearch

ElasticSearch has an active community and the release cycles are very fast.

Because ElasticSearch depends on many common Java libraries (Lucene, Guice, and Jackson are the most famous ones), the ElasticSearch community tries to keep them updated and fix bugs that are discovered in them and in ElasticSearch core.

If it's possible, the best practice is to use the latest available release (usually the more stable one).

Getting ready

A supported ElasticSearch Operative System (Linux/MacOSX/Windows) with installed Java JVM 1.6 or above is required. A web browser is required to download the ElasticSearch binary release.

How to do it...

For downloading and installing an ElasticSearch server, we will perform the steps given as follows:

  1. Download ElasticSearch from the Web.

    The latest version is always downloadable from the web address http://www.elasticsearch.org/download/.

    There are versions available for different operative systems:

    • elasticsearch-{version-number}.zip: This is for both Linux/Mac OSX, and Windows operating systems
    • elasticsearch-{version-number}.tar.gz: This is for Linux/Mac
    • elasticsearch-{version-number}.deb: This is for Debian-based Linux distributions (this also covers Ubuntu family)

    These packages contain everything to start ElasticSearch.

    At the time of writing this book, the latest and most stable version of ElasticSearch was 0.90.7. To check out whether this is the latest available or not, please visit http://www.elasticsearch.org/download/.

  2. Extract the binary content.

    After downloading the correct release for your platform, the installation consists of expanding the archive in a working directory.

    Choose a working directory that is safe to charset problems and doesn't have a long path to prevent problems when ElasticSearch creates its directories to store the index data.

    For windows platform, a good directory could be c:es, on Unix and MacOSX /opt/es.

    To run ElasticSearch, you need a Java Virtual Machine 1.6 or above installed. For better performance, I suggest you use Sun/Oracle 1.7 version.

  3. We start ElasticSearch to check if everything is working.

    To start your ElasticSearch server, just go in the install directory and type:

    # bin/elasticsearch –f            (for Linux and MacOsX)
    

    or

    # binelasticserch.bat –f         (for Windows)
    

    Now your server should start as shown in the following screenshot:

    How to do it...

How it works...

The ElasticSearch package contains three directories:

  • bin: This contains script to start and manage ElasticSearch. The most important ones are:
    • elasticsearch(.bat): This is the main script to start ElasticSearch
    • plugin(.bat): This is a script to manage plugins
  • config: This contains the ElasticSearch configs. The most important ones are:
    • elasticsearch.yml: This is the main config file for ElasticSearch
    • logging.yml: This is the logging config file
  • lib: This contains all the libraries required to run ElasticSearch

There's more...

During ElasticSearch startup a lot of events happen:

  • A node name is chosen automatically (that is Akenaten in the example) if not provided in elasticsearch.yml.
  • A node name hash is generated for this node (that is, whqVp_4zQGCgMvJ1CXhcWQ).
  • If there are plugins (internal or sites), they are loaded. In the previous example there are no plugins.
  • Automatically if not configured, ElasticSearch binds on all addresses available two ports:
    • 9300 internal, intra node communication, used for discovering other nodes
    • 9200 HTTP REST API port
  • After starting, if indices are available, they are checked and put in online mode to be used.

There are more events which are fired during ElasticSearch startup. We'll see them in detail in other recipes.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.134.104.161