elasticsearchcratecratedb

Crate DB how to set the parameter "wait_for_active_shards" when create a table?


I set up a crateDB cluster of 5 nodes. And the situations are as follows:

  1. (the number_of_replicas is 2, the wait_for_active_shards is "all") When one node down, the write process will report an error: Not enough active copies to meet shard count of [ALL] (have 2, needed 3).

  2. (the number_of_replicas is "0-4", the wait_for_active_shards is "all") when one down, all fine. But while it is recovering, the write process will report an error: Not enough active copies to meet shard count of [ALL] (have 4, needed 5).

So, how can I set the wait_for_active_shards or the number_of_replicas to make sure that when at least one nodes down will not influence the cluster and the write process?

P.S. Is there any formula to calculate the value of this parameter

"wait_for_active_shards" like "int( (primary + number_of_replicas) / 2 ) + 1" ?

Solution

  • set the number of wait_for_active_shards to the number_of_replicas. see our documentation here: https://crate.io/docs/crate/reference/en/latest/sql/statements/create-table.html#write-wait-for-active-shards