Elasticsearch is an enterprise level open source search server based on Apache Lucene, it offers a real-time distributed search and analytics with a RESTful web interface and schema-free JSON documents. Elasticsearech is developed in Java and is released under the Apache License, currently it is ranked second in most popular enterprise search engine, behind Apace Solr.
This guide will help you to install Elasticsearch on CentOS 7 / Ubuntu 14.10 / Linux Mint 17.1.
As said earlier, Elasticsearch is developed in Java. Make sure you have the latest JDK 8 installed on your system.
Elasticsearch can be downloaded directly from the official website, more than that, it offers a pre-built binary packages for RHEL and Debian derivatives.
Download and install public signing key.
Add and enable Elasticsearch repository
Install Elasticsearch by using following command.
Configure Elasticsearch to auto-start during system startup.
Elasticsearch configuration files can be found in /etc/elasticsearch/ directory, you could see only two files in it, elasticsearch.yml and logging.yml. logging.yml manages the logging of elasticsearch, logs files are stored in /var/log/elasticsearch directory.
elasticsearch.yml is the main configuration file of elasticsearch, contains default settings for running production cluster.
Elasticsearch, by default, binds to all network cards (0.0.0.0), and listens on port no 9200 – 9300 for HTTP traffic and on 9300 – 9400 for internal node to node communication, ranges means that if the port is busy, it will automatically try the next port.
Edit elasticsearch.yml file.
In order to make Elasticsearch to listen on particular ip, place the ip address on following syntax. To protect elasticsearch from public access, you can set it to listen on localhost.
Restart the Elasticsearch service.
Once you restarted, wait for at least a minute to let the Elasticsearch get fully started, otherwise testing will fail. Elastisearch should be now listen on 9200 for processing HTTP request, we will use CURL to get the response.
You should get the response like below.
Alternatively, you can use browser to query the Elasticsearch by visiting :9200. You should see the same as you saw using curl.
The setting cluster.name is used to discover and auto-join other nodes, If a group of Elasticsearch servers on the same network have the same cluster name, they will discover each others. Make sure you change the default cluster name of Elasticsearch server, to avoid auto-joining of other servers on the same network that are not under your control.
If you are running multiple Elasticsearch clusters on the same network, make sure you are using unique cluster names.
This is like a host name for Elasticsearch server, node name is dynamically generated during the service startup. You can set it your own name by setting the following syntax.
Do not forget to restart the Elasticsearch service.