In this paper, we create a clustring system which contributed from elasticsearch servers that are located in different places and have differens system property.

Before the explain how it works and configuration, we should explain some definitions.

Distributed System Architecture

Cluster System Architecture

Cluster: Cluster Server is computer program that allows server computers to work together as a computer cluster, to provide failover and increased availability of applications, or parallel calculating power in case of high-performance computing (HPC) clusters (as in supercomputing).(Source link)

Distributed : Distributed computing is any computing that involves multiple computers remote from each other that each have a role in a computation problem or information processing. (Source link)

Building ElasticSearch cluster is a very easy so we focus on distributed servers on this paper without install any 3.part software. Our servers both are different physical location but same timezone.

Clustring ElasticSearch  Architecture

ElasticSearch is build and use system for cluster. it automatically recognise other elasticsearch clusters in the same network. If two elastic’s IP is same as 192.168.0.X olduğu sürece birbirini tanıyacaktır. They are automatically recognize them.

To make cluster in same network you should do it

open “conf/elasticsearch.yml” and write “cluster.name: clusterone” in document. (default cluster name elasticsearch) elasticsearch automatically find other elasticsearch which are same cluster name.

Distributed ElasticSearch  Architecture 

It is not very complex to connect elasticsearch as a cluster. It must be a master node.master=true which responds to user’s request.  (Default node.master=true). Other node’s can be master or slave. If you want to separate serving nodes from data nodes, You should make node.data: false and this node only respond to request. (Default is true)

Please don’t forget name of computer which will be same cluster must be have same name. Node.name has not any affect except for naming and easily finding when analyse however nodes name must be different. The most important part of this process  is master’s  discovery.zen.ping.multicast.enabled:true and slave’s discovery.zen.ping.multicast.enabled: false. In addition to this, slave’s discovery.zen.ping.unicast.hosts must be master’s IP:Port

This is real working example’s configuration files.

Sample Configuration

Server 1 – Main Server

-cluster.name: ahmettet         # Cluster Name’s must be same
-node.name: “ahmetlocal1″   # There is no effect except for reading logs
-node.master: true      # We choose this server as a master, our application program must be connect this
-node.data: true          # There is a option that storing active or deactive
(it must be default is about discovery.zen)

Server 2 – Slave Server

-cluster.name: ahmettet        # Cluster Name’s must be same
-node.name: “ahmetlocal2″  # There is no effect except for reading logs
-node.master: false                 # We choose this server as a slave, there is no way to connect via http
-node.data: true                      # There is a option that storing active or deactivate.
-discovery.zen.ping.multicast.enabled: false                           # Closed automatic find servers than we can manage connections
-discovery.zen.ping.unicast.hosts: [“84.201.37.151:9305”]   # It must be given  IP of Master Server and add communication port after the IP.

(I separate code and comments with “-“. I recommend that to look  sample elasticsearch.yml on end of the this page)

Notes:

  • There must be same on authorization, It means username and password must be same both servers.
  • You must be restart elasticsearch when you modify elastichsearch.yml
  • If you install elastichsearch with dpkg, you must modify linux’s elasticsearch config, There is no effect if you modify local elasticsearh/config documents. Addition to this, If elasticsearch was install by dpkg, maneul elasticsearch/bin command do not affact system.
  • There is no differences between Windows and Linux Systems
  • It can be write nameserver instead of IP like server1.elasticsearchturkiye.com
  • Monitoring  : You can view last status of  nodes with http://localhost:9206/_cat/health?v

 Downlod ElasticSearch.yml

This article is available in Turkish on this link
Bu Makalenin Türkçesine şuradan ulaşabilirsiniz.

Reklamlar