Bird
0
0

What is the best shard and replica configuration to avoid shard allocation errors?

hard🚀 Application Q15 of 15
Elasticsearch - Basics and Architecture
You want to design an Elasticsearch cluster for high availability with 4 nodes. You plan to create an index with 6 primary shards and 2 replicas per shard. What is the best shard and replica configuration to avoid shard allocation errors?
A6 primary shards and 3 replicas per shard, total 24 shards
B6 primary shards and 2 replicas per shard, total 18 shards
C6 primary shards and 1 replica per shard, total 12 shards
D4 primary shards and 2 replicas per shard, total 12 shards
Step-by-Step Solution
Solution:
  1. Step 1: Check replica limit based on nodes

    With 4 nodes, max replicas per shard = nodes - 1 = 3. So 2 replicas is allowed.
  2. Step 2: Consider shard allocation rules

    Each shard copy must be on a different node. 6 primary shards + 2 replicas = 18 shards total, but 18 shards on 4 nodes means some nodes hold multiple shards.
  3. Step 3: Avoid allocation errors by balancing shards

    Too many shards per node can cause performance issues. 1 replica (total 12 shards) is safer and avoids errors.
  4. Final Answer:

    6 primary shards and 1 replica per shard, total 12 shards -> Option C
  5. Quick Check:

    Replicas ≤ nodes - 1 and balanced shards [OK]
Quick Trick: Replicas max = nodes - 1; balance shards per node [OK]
Common Mistakes:
MISTAKES
  • Setting replicas more than nodes - 1
  • Ignoring shard distribution limits
  • Choosing fewer shards than needed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes