View the health status of a single-node Elasticsearch
Use the head plugin to view the cluster status
From the above screenshot, it can be seen that there are 5 unassigned shards, when the index blog5 is created, the number of shards is 5, the number of replicas is 1, and the cluster status becomes yellow after the new creation, the root cause is that the cluster has not enabled replica shards, let's take a look at the introduction of replica shards given on the official website:
The main purpose of replica sharding is for failover, as discussed in Principles within a cluster: if the node holding the primary shard hangs up, a replica shard is promoted to the role of the primary shard.
Then it can be seen that replica shards and primary shards cannot be placed on one node, but in a cluster with only one node, replica shards cannot be assigned to other nodes, so all replica shards are unassigned. Because there is only one node, if there is a primary shard node hanged, then the entire cluster should be hung up, and there is no case where the replica shard is upgraded to the primary shard.
The solution is to delete the index with replica shards in the single-node elasticsearch cluster, and set the replicas of the new index to 0. Then check the cluster status
The number of copies of the new index is set to 0
The cluster is healthy
|