How to find out if replication is in progress in a cluster

hello,

I am looking for a reliable way where we can say that replication is in progress on a node ?

From the below output, what are the parameters based on which i can reliably tell that replication is in progress/completed on a cluster ?
I know that cluster status "yellow" is 1 way , can we also rely on any other parameters apart from status ?

GET _cluster/health

COPY AS CURLVIEW IN CONSOLE

Returns this:

{ "cluster_name" : "testcluster", "status" : "yellow", "timed_out" : false, "number_of_nodes" : 1, "number_of_data_nodes" : 1, "active_primary_shards" : 5, "active_shards" : 5, "relocating_shards" : 0, "initializing_shards" : 0, "unassigned_shards" : 5, "delayed_unassigned_shards": 0, "number_of_pending_tasks" : 0, "number_of_in_flight_fetch": 0, "task_max_waiting_in_queue_millis": 0, "active_shards_percent_as_number": 50.0 }

This tells you that no shards are currently being initialized or relocated, which means Elasticsearch is done balancing your cluster.

The reason your cluster is in a yellow state is because of these 5 unassigned shards, that will remain unassigned because they are replicas of the 5 primary shards you have. The reason they can't be assigned is that you cluster only has one data node:

A replica shard can never be assigned to the same node hosting the primary (because a main point with replica shards is to provide backup if a node goes down). There are two ways you can make your cluster state green:

  1. Add a second data node so that replica shards can be assigned.
  2. Turn off replica shards for your indices (see Update Indices Settings).

Good luck!

Thank you for your response..

i undertstand how to fix the cluster status Yellow.

My question is if there is any way to identify if cluster status is yellow because of an ongoing replication process within cluster.. Can we conclude that if replication is yellow because of ongoing replication, then the "relocating shards" and "initializing shards settings" values will be non-zero

Any reply for this question ?

Maybe you could use the cat recovery API or indices recovery API?

Thanks christian for reposne...

This looks little confusing.. Documentation says that this is the response for a live recovery.. But the stage is shown as done. Does this make sense ? Also, what are the valid recovery stages and recovery types (peer | store | snapshot)

i s t ty st
twitter 0 1252ms peer done

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.