简体   繁体   中英

elasticsearch cluster green with only one node

I have an elasticsearch cluster that only reports that it is green but reports only one node . From my research the cluster should be yellow and there should be two separate clusters . So could someone explain why the cluster below is reporting a green status ?

{
  "cluster_name" : "elasticsearch",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 2,
  "active_shards" : 2,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0,
  "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" : 100.0
}

The cluster is being configured for clustering in elasticsearch.yml , and before those changes it properly reported a yellow status with the same 2 shards per node .

you have two primary shards in your cluster with no replica. both shards are assigned to one data node.

if you increase Number_of_replicas to 1 or higher, you would see the yellow status of cluster. on that moment you can do two things. 1) add another data node. 2) change elastic setting to force assign both primary and replica shards to one node (not recommended).

The cluster is green because there are 0 unassigned shards - every shard that needs a home has one. This is likely because you have indices with number_of_replicas set to 1, and since you have 1 active node in your cluster, all replica requirements are satisfied. This is generally a bad idea, as it doesn't provide any redundancy.

If you create indices with number_of_replicas set to a value larger than 1, you will need at least that many machines active in the cluster to be eligible for green status.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM