8

I already understand that Elastic Search is supposed to be deployed in a distributed topology, in that you can have multiple nodes for a cluster of ES instances.

I like the API, and it looks promising. But I wonder how Elastic Search solves some standard problems in distributed computing. My "architectural" questions are motivated out of trying to understand whether I ought to commit to using the product.

Consider membership problem: If I add a node to the cluster, how does Elastic Search cluster know to add that node wants to join? Or what if a node goes down (or the network to the data center it is in) gets too flaky. Is it using some sort of gossip protocol like Amazon Dynamo does?

Consider the consensus problem: if I POST a document to one node to the cluster, how does the change get propagated to the other nodes? Of course, I understand that the document has to be indexed, so I cannot expect a search query to find it immediately. Does ES use a Paxos algorithm? Raft algorithm?

UPDATE: A nice discussion of the split-brain problem in Elastic Search.

5
  • I have not that much experience with Elasticsearch yet, but for the first question: Each node gets configured and told what cluster it belongs to. It will then search for that clusters master node and connect to it (or take the role of master if it is allowed to and no present master available). Each index gets configured with the amount of replications it should have within its cluster and the nodes (or node masters) will decide on which node(s) it will be replicated. The nodes handle this by themselves (though you can influence this behaviour a lot when creating an index) Jul 31, 2014 at 11:59
  • I would strongly recommend to setup a small cluster on at least three VMs and try it out. Not only is the API great, but Elasticsearch comes with monitoring features that allow you to see what exactly happens on each node and where data is stored and replicated. Jul 31, 2014 at 12:01
  • 1
    @thorsten: Thanks for the tag and comment. The API for Elastic Search is quite impressive, but both of their sites (.org & .com) have a strong marketing bent with just enough technical detail to hook in an engineer. I've been spoiled by Typesafe's documentation for Akka.
    – Alan
    Jul 31, 2014 at 16:26
  • The link provided in one of the answers doesn't work anymore. High level information about discovery and cluster formation mechanism in Elasticsearch can be found here. May 31, 2021 at 18:52
  • Thanks @narendra-choudhary ... I've done my best to update the links.
    – Alan
    Jun 28, 2021 at 17:33

2 Answers 2

1

There are also some tweaks you can apply on server configuration, in order to reduce split-brain problems in large(ish) clusters, namely the so-called discovery.zen.* parameters.

There is not that much information about the inner workings and algorithms of ES, but what I found during my evaluation was the reference documentation about the server setup.

In particular, a nice thing about ES is that almost all the server configuration is done through a single file, elasticsearch.yml, under the ./config dir of your installation.

So, I would start with the setup configuration and I would go on opening the actual .yml on your installation. It's commented really well, and goes into explaining a lot of things (including the "zen" parameters used to solve split-brain problems) and cross-links to web pages.

1

There is not an incredible amount of detail in the online Elasticsearch: The Definitive Guide, but suffice to say, with respect to:

  1. Cluster membership: the oldest node becomes the "master" and it appears some sort of gossip protocol is used when nodes join and leave the cluster.
  2. A leadership election does occur when the master leaves the cluster (which I tried for myself). Elastic Search does not state how they pull this off, and they want to leave this encapsulated for their users.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.