Elasticsearch Cluster – How It Works
Questions will be solved
What is a cluster of nodes ?
- Start a ES instance => a cluster of single node.
- Start another ES instance with the same
cluster.name => a cluster of 2 nodes.
- How nodes talk to each other:
- How nodes talk to external:
JSON over HTTP
- Each node can play one or more roles in cluster.
What is role of master/client/data ?
nodes from cluster
- Broadcast changes to other nodes
- Only 1 master node at a time.
data in the shards => CRUD, search, aggregations on
- Routing requests to master/data =>
Adding a node to cluster
- It will ping all nodes => find master node => request to join => accepted & joined.
- If joined node is data => the master will re-allocate data to this node.
Removing a node to cluster
- The master node will remove this node from cluster, broadcast changes the all nodes.
- If removed node is data => the master will re-allocate data.
- If remove node is master => one of the other master nodes will be elected to be master ( Fault Detection )
How ElasticSearch organizes data ?
- Elasticsearch as MySQL
- Index <=> Database
- Type <=> Table
- Document <=> Row
- Field <=> Column
- Index is one or more
shards distributed on muliple nodes
- Number of primary shards can NOT be changed after index created