Steps to install Elasticsearch
Table of Contents
Steps to Install External Elasticsearch 5.5.0:
Download Location for the Elastic search :
https://www.elastic.co/downloads/past-releases/elasticsearch-5-5-0
For Windows:
Download elastic search version 5.5.0 from website (https://www.elastic.co/downloads/past-releases )
Download zip file
Unzip the file
Go to the unzipped path → config → elasticsearch.yml file
Edit the elasticsearch.yml file
Start the service by running the elasticsearch.bat file from unzipped path → bin
You can also install Elasticsearch on Windows as a service. To do that:
Open the command prompt as a user or admin.
Navigate to the <Elasticsearch>/bin folder.
Run the following command:
elasticsearch-service.bat install
Now check your Windows services. You will see the running Elasticsearch service.
For Linux (rpm) :
Download .rpm file . In linux shell command prompt run the below command to Install elastic search version 5.5.0
sudo rpm -ivh elasticsearch-5.5.0.rpm
sudo yum localinstall elasticsearch-5.5.0.rpm
or
Download using wget command from linux shell command prompt
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.0.rpmGo to the Installation path (etc/elasticsearch) → elasticsearch.yml file
Edit the elasticsearch.yml file
start the service using below command
sudo systemctl start elasticsearch.service
location of the yml
/etc/elasticsearch/elasticsearch.yml
location of the index
/var/lib/elasticsearch
Location of the bin
/usr/share/elasticsearch
Location of the Logs
/var/log/elasticsearch/
Or
/usr/share/elasticsearch/logs
For Linux Debian
Debian
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.0.deb
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.0.deb.sha512
shasum -a 512 -c elasticsearch-5.5.0.deb.sha512
sudo dpkg -i elasticsearch-5.5.0.deb
#Start and Stop the Elastic Search
sudo -i service elasticsearch start
sudo -i service elasticsearch stop
Do the following changes Example Elasticsearch.yml and update the following parameters:
Elastic Search Single Node
ZEE Server and Elastic Search is in same Server
Single node Elastic Search
cluster.name: zephyr
node.name: "Node1"
node.master: true
node.data: true
transport.tcp.port: 9300
http.port: 9200
script.inline: true
script.stored: true
indices.query.bool.max_clause_count: 9012ZEE and Elastic Search in Different Server
Single node Elastic Search
cluster.name: zephyr
node.name: "Node1"
node.master: true
node.data: true
script.inline: true
script.stored: true
network.bind_host: 192.168.45.21
network.publish_host: 192.168.45.21
network.host: 192.168.45.21
transport.tcp.port: 9300
http.port: 9200
discovery.zen.ping.unicast.hosts: ["192.168.45.21:9300"]
indices.query.bool.max_clause_count: 9012Sample elasticsearch.yml file attached : Example Elasticsearch.yml
Changes need to do in Zephyr
In Jdbc properties need to change
#transport|node
transport.nodes=192.168.45.21:9300, 192.168.45.22:9300
ElasticSearch Cluster
Elastic Search in cluster should be in Odd Number minimum node to be in elastic search cluster should be 3 node
Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
cluster node Elastic Search
#ESNode 1 (192.168.11.144)
cluster.name: zephyr
node.name: "ESNode1"
node.master: true
node.data: true
network.host: 192.168.11.144
http.port: 9200
transport.tcp.port: 9300
network.bind_host: 192.168.11.144
network.publish_host : 192.168.11.144
discovery.zen.ping.unicast.hosts: ["192.168.11.144:9300","192.168.11.145:9300","192.168.11.146:9300"]
discovery.zen.minimum_master_nodes: 2
script.inline: true
script.stored: true
indices.query.bool.max_clause_count: 9012
------------------------------------------------------------------------------------------------------------------------------------
#ESNode 2 (192.168.11.145)
cluster.name: zephyr
node.name: "ESNode2"
node.master: true
node.data: true
network.host: 192.168.11.145
http.port: 9200
transport.tcp.port: 9300
network.bind_host: 192.168.11.145
network.publish_host : 192.168.11.145
discovery.zen.ping.unicast.hosts: ["192.168.11.144:9300","192.168.11.145:9300","192.168.11.146:9300"]
discovery.zen.minimum_master_nodes: 2
script.inline: true
script.stored: true
indices.query.bool.max_clause_count: 9012
---------------------------------------------------------------------------------------------------------------------------------------
#ESNode 3 (192.168.11.146)
cluster.name: zephyr
node.name: "ESNode3"
node.master: true
node.data: true
network.host: 192.168.11.146
http.port: 9200
transport.tcp.port: 9300
network.bind_host: 192.168.11.146
network.publish_host : 192.168.11.146
discovery.zen.ping.unicast.hosts: ["192.168.11.144:9300","192.168.11.145:9300","192.168.11.146:9300"]
discovery.zen.minimum_master_nodes: 2
script.inline: true
script.stored: true
indices.query.bool.max_clause_count: 9012
NOTE :
discovery.zen.ping.unicast.hosts should contain all the elasticsearch system's host ip and port which are in cluster.
Sample elasticsearch.yml file attached :
ESNode 1 | |
EsNode 2 | |
EsNode 3 |
If elastic Search is in Cluster then in ZE we have to change the "number_of_shards" and "number_of_replicas"
Navigate to the ZE installation Dir
C:\Program Files\Zephyr\tomcat\webapps\flex\WEB-INF\template\zephyr
In this file _settings.json
change the number of shards and number of replicas
{
"index" : {
"number_of_shards" : 2,
"number_of_replicas" : 1
}
}
NOTE: for single node of the Elastic search this configuration should be default
Changes need to do in Zephyr
In Jdbc properties need to change
#transport|node
transport.nodes=192.168.11.144:9300,192.168.11.145:9300.192.168.11.146:9300
Document Reference :
http://www.philipotoole.com/avoiding-elasticsearch-split-brain/
https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery-zen.html
https://www.elastic.co/guide/en/elasticsearch/reference/current/rpm.html
https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html