Facebooktwittergoogle_plusredditpinterestlinkedinmail

Install Elasticsearch 5.0 on RHEL / CentOS

This article will cover install Elasticsearch 5.x version on CentOS and RHEL distribution. Also guideline to change to Default Cluster and Index settings in Elasticsearch 5.x. So Let’s start with prerequisites

Prerequisites:

As per the recommendation Elasticsearch need 1.8.0_73 or later and only Oracle’s Java and the OpenJDK are supported.

Install Elasticsearch 5.x On RHEL / CentOS using Elasticsearch Repository

Install Public Signing Key:

rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch

Create new repo in your /etc/yum.repos.d/ directory. For example I have created elasticsearch.repo here.

/etc/yum.repos.d/elasticsearch.repo

[elasticsearch-5.x]
name=Elasticsearch repository for 5.x packages
baseurl=https://artifacts.elastic.co/packages/5.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

Now your yum repository ready for use. You can install Elasticsearch 5.0 using below yum command.

yum install elasticsearch

Note: The repositories do not work with older rpm based distributions that still use RPM v3, like CentOS5.
Add Elasticsearch service to start automatically when the system boots up:

chkconfig --add elasticsearch

You can start stop Elasticsearch using service command

service elasticsearch start
service elasticsearch stop

Now we have done with Elasticsearch installation. You can check your default Elasticsearch configuration in /etc/elasticsearch/elasticsearch.yml

By default its cluster name will be elasticsearch.

Now we will change Cluster, Index and Host info in elasticsearch.yml

To illustrate here I am naming my Elasticsearch cluster name “Techieroop” and node name “techieroop-es-node“. Add your host into “discovery.zen.ping.unicast.hosts“.

Summary of important Elasticsearch Configuration:

cluster.name: TechieRoop
node.name: techieroop-es-node
discovery.zen.ping.unicast.hosts: ["127.0.0.1"]

Your elasticsearch.yml will be look like this

# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please see the documentation for further information on configuration options:
# <https://www.elastic.co/guide/en/elasticsearch/reference/5.0/settings.html>
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: TechieRoop
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: techieroop-es-node
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
#path.data: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
#network.host: 192.168.0.1
#
# Set a custom port for HTTP:
#
#http.port: 9200
#
# For more information, see the documentation at:
# <https://www.elastic.co/guide/en/elasticsearch/reference/5.0/modules-network.html>
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
discovery.zen.ping.unicast.hosts: ["127.0.0.1"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1):
#
#discovery.zen.minimum_master_nodes: 3
#
# For more information, see the documentation at:
# <https://www.elastic.co/guide/en/elasticsearch/reference/5.0/modules-discovery-zen.html>
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, see the documentation at:
# <https://www.elastic.co/guide/en/elasticsearch/reference/5.0/modules-gateway.html>
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true

Start the Elasticsearch:

sudo service elasticsearch start

Verify you installation :

curl -XGET 'localhost:9200'

Output:

{
  "name" : "techieroop-es-node",
  "cluster_name" : "Techieroop",
  "cluster_uuid" : "nmTipFvpSQO3Kp8tXUbDDQ",
  "version" : {
	"number" : "5.0.1",
	"build_hash" : "080bb47",
	"build_date" : "2016-11-11T22:08:49.812Z",
	"build_snapshot" : false,
	"lucene_version" : "6.2.1"
  },
  "tagline" : "You Know, for Search"
}
Install Elasticsearch 5.0 on RHEL / CentOShttp://techieroop.com/wp-content/uploads/2016/11/install-elasticsearch-on-RHEL-CentOS-6-7.pnghttp://techieroop.com/wp-content/uploads/2016/11/install-elasticsearch-on-RHEL-CentOS-6-7-150x121.png Roopendra DevOPSElasticsearch,,
Install Elasticsearch 5.0 on RHEL / CentOS This article will cover install Elasticsearch 5.x version on CentOS and RHEL distribution. Also guideline to change to Default Cluster and Index settings in Elasticsearch 5.x. So Let's start with prerequisitesPrerequisites:As per the recommendation Elasticsearch need 1.8.0_73 or later and only Oracle’s Java...
<h3>Install Elasticsearch 5.0 on RHEL / CentOS</h3> This article will cover install Elasticsearch 5.x version on CentOS and RHEL distribution. Also guideline to change to Default Cluster and Index settings in Elasticsearch 5.x. So Let's start with prerequisites<strong>Prerequisites:</strong>As per the recommendation Elasticsearch need <span class="strong"><strong>1.8.0_73 or later</strong></span> and only <a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">Oracle’s Java</a> and the <a href="http://openjdk.java.net/">OpenJDK</a> are supported. <h3>Install Elasticsearch 5.x On RHEL / CentOS using Elasticsearch Repository</h3> <strong>Install Public Signing Key:</strong> <pre class="programlisting prettyprint lang-sh prettyprinted"><span class="pln">rpm </span><span class="pun">--</span><span class="pln">import https</span><span class="pun">://</span><span class="pln">artifacts</span><span class="pun">.</span><span class="pln">elastic</span><span class="pun">.</span><span class="pln">co</span><span class="pun">/</span><span class="pln">GPG</span><span class="pun">-</span><span class="pln">KEY</span><span class="pun">-</span><span class="pln">elasticsearch</span></pre> Create new repo in your <strong>/etc/yum.repos.d/</strong> directory. For example I have created elasticsearch.repo here./etc/yum.repos.d/elasticsearch.repo <pre class="programlisting prettyprint lang-sh prettyprinted"><span class="pun">[</span><span class="pln">elasticsearch</span><span class="pun">-</span><span class="lit">5.x</span><span class="pun">]</span><span class="pln"> name</span><span class="pun">=</span><span class="typ">Elasticsearch</span><span class="pln"> repository </span><span class="kwd">for</span> <span class="lit">5.x</span><span class="pln"> packages baseurl</span><span class="pun">=</span><span class="pln">https</span><span class="pun">://</span><span class="pln">artifacts</span><span class="pun">.</span><span class="pln">elastic</span><span class="pun">.</span><span class="pln">co</span><span class="pun">/</span><span class="pln">packages</span><span class="pun">/</span><span class="lit">5.x</span><span class="pun">/</span><span class="pln">yum gpgcheck</span><span class="pun">=</span><span class="lit">1</span><span class="pln"> gpgkey</span><span class="pun">=</span><span class="pln">https</span><span class="pun">://</span><span class="pln">artifacts</span><span class="pun">.</span><span class="pln">elastic</span><span class="pun">.</span><span class="pln">co</span><span class="pun">/</span><span class="pln">GPG</span><span class="pun">-</span><span class="pln">KEY</span><span class="pun">-</span><span class="pln">elasticsearch enabled</span><span class="pun">=</span><span class="lit">1</span><span class="pln"> autorefresh</span><span class="pun">=</span><span class="lit">1</span><span class="pln"> type</span><span class="pun">=</span><span class="pln">rpm</span><span class="pun">-</span><span class="pln">md</span></pre> Now your yum repository ready for use. You can install Elasticsearch 5.0 using below yum command. <pre>yum install elasticsearch</pre> Note: The repositories do not work with older rpm based distributions that still use RPM v3, like CentOS5. Add Elasticsearch service to start automatically when the system boots up: <pre>chkconfig --add elasticsearch</pre> You can start stop Elasticsearch using service command <pre>service elasticsearch start service elasticsearch stop</pre> Now we have done with Elasticsearch installation. You can check your default Elasticsearch configuration in <strong>/etc/elasticsearch/elasticsearch.yml</strong>By default its cluster name will be elasticsearch.Now we will change Cluster, Index and Host info in elasticsearch.ymlTo illustrate here I am naming my Elasticsearch cluster name "<em><strong>Techieroop</strong></em>" and node name "<em><strong>techieroop-es-node</strong></em>". Add your host into "<strong><em>discovery.zen.ping.unicast.hosts</em></strong>".Summary of important Elasticsearch Configuration: <pre>cluster.name: TechieRoop node.name: techieroop-es-node discovery.zen.ping.unicast.hosts: ["127.0.0.1"]</pre> Your <strong>elasticsearch.yml</strong> will be look like this <pre># ======================== Elasticsearch Configuration ========================= # # NOTE: Elasticsearch comes with reasonable defaults for most settings. # Before you set out to tweak and tune the configuration, make sure you # understand what are you trying to accomplish and the consequences. # # The primary way of configuring a node is via this file. This template lists # the most important settings you may want to configure for a production cluster. # # Please see the documentation for further information on configuration options: # <https://www.elastic.co/guide/en/elasticsearch/reference/5.0/settings.html> # # ---------------------------------- Cluster ----------------------------------- # # Use a descriptive name for your cluster: # cluster.name: TechieRoop # # ------------------------------------ Node ------------------------------------ # # Use a descriptive name for the node: # node.name: techieroop-es-node # # Add custom attributes to the node: # #node.attr.rack: r1 # # ----------------------------------- Paths ------------------------------------ # # Path to directory where to store the data (separate multiple locations by comma): # #path.data: /path/to/data # # Path to log files: # #path.logs: /path/to/logs # # ----------------------------------- Memory ----------------------------------- # # Lock the memory on startup: # #bootstrap.memory_lock: true # # Make sure that the heap size is set to about half the memory available # on the system and that the owner of the process is allowed to use this # limit. # # Elasticsearch performs poorly when the system is swapping the memory. # # ---------------------------------- Network ----------------------------------- # # Set the bind address to a specific IP (IPv4 or IPv6): # #network.host: 192.168.0.1 # # Set a custom port for HTTP: # #http.port: 9200 # # For more information, see the documentation at: # <https://www.elastic.co/guide/en/elasticsearch/reference/5.0/modules-network.html> # # --------------------------------- Discovery ---------------------------------- # # Pass an initial list of hosts to perform discovery when new node is started: # The default list of hosts is ["127.0.0.1", "[::1]"] # discovery.zen.ping.unicast.hosts: ["127.0.0.1"] # # Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1): # #discovery.zen.minimum_master_nodes: 3 # # For more information, see the documentation at: # <https://www.elastic.co/guide/en/elasticsearch/reference/5.0/modules-discovery-zen.html> # # ---------------------------------- Gateway ----------------------------------- # # Block initial recovery after a full cluster restart until N nodes are started: # #gateway.recover_after_nodes: 3 # # For more information, see the documentation at: # <https://www.elastic.co/guide/en/elasticsearch/reference/5.0/modules-gateway.html> # # ---------------------------------- Various ----------------------------------- # # Require explicit names when deleting indices: # #action.destructive_requires_name: true </pre> <strong>Start the Elasticsearch:</strong> <pre>sudo service elasticsearch start</pre> <strong>Verify you installation :</strong> <pre>curl -XGET 'localhost:9200'</pre> <strong>Output:</strong> <pre>{ "name" : "techieroop-es-node", "cluster_name" : "Techieroop", "cluster_uuid" : "nmTipFvpSQO3Kp8tXUbDDQ", "version" : { "number" : "5.0.1", "build_hash" : "080bb47", "build_date" : "2016-11-11T22:08:49.812Z", "build_snapshot" : false, "lucene_version" : "6.2.1" }, "tagline" : "You Know, for Search" } </pre>
(Visited 1,673 times, 242 visits today)
Facebooktwittergoogle_pluslinkedinrss