Understanding clusters, replication, and sharding

Related to shard management, there is the key concept of replication and cluster status.

Getting ready

You need one or more nodes running to have a cluster. To test an effective cluster, you need at least two nodes (that can be on the same machine).

How it works...

An index can have one or more replicas; the shards are called primary if they are part of the primary replica, and secondary ones if they are part of replicas.

To maintain consistency in write operations, the following workflow is executed:

  • The write operation is first executed in the primary shard
  • If the primary write is successfully done, it is propagated simultaneously in all the secondary shards
  • If a primary shard becomes unavailable, a ...

Get ElasticSearch Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.