* Horizontal escalation.
* Distribute and parallelize operations across shards, increasing the performance and throughput.
In addition, you can make one or more copies of the index shards in what are called replica shards, or replicas for short.
* It provides high availability in case a shard or node fails.
* It allows search volume and throughput to scale since searches can be executed on all replicas in parallel.
Here it is important to mention that:
The number of shards and replicas can be defined per index at the time of their creation. Once the index is created, the number of replicas must be changed dynamically, whereas the number of fragments cannot be changed afterward.
How many shards should an index have?
As it is not possible to "reshard" (changing the number of shards) without reindexing, careful consideration should be given to how many shards will be needed before creating the first index. The number of nodes in the installation will influence the number of shards to be planned. In general, the most optimal performance will be realized by using the same number of shards as nodes. Thus, a cluster with three nodes should have three shards, while a cluster with one node would only need one shard.
How many replicas should an index have?Here is an example of how a cluster with three nodes and three shards could be set up:
No replica: Each node has one shard. If a node goes down, an incomplete index of two fragments will remain.
One replica: Each node has one shard and one replica. If a node goes down, a full index will remain.
Two replicas: Each node has one shard and two replicas (the full index). With this setup, the cluster can continue to operate even if two nodes go down. Although this seems to be the best solution, it increases the storage requirements.
So, to have the indices mirrored you will need to configure the number of replicas to 1.
Changing the number of replicas
The number of replicas can be changed dynamically using the Elasticsearch API. In a cluster with one node, the number of replicas should be set to zero:
# curl -X PUT "http://localhost:9200/wazuh-alerts-\*/_settings?pretty" -H 'Content-Type: application/json' -d'
{
"settings" : {
"number_of_replicas" : 0
}
}'Regarding your second question, the indexer node can be configured in different ways that you can be defined, by default they work in parallel they Manage the overall operation of a cluster, and keeps track of the cluster state. This includes creating and deleting indexes and allocating shards to nodes. Stores and searches data. Performs all data-related operations (indexing, searching, aggregating) on local shards.