elasticsearch 状态查看:health为 yellow的解决办法
---------------------
```shell
[root@VM_0_4_centos ~]# curl -XGET http://localhost:9200/_cluster/health?pretty=true
{
"cluster_name" : "elasticsearch",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 9,
"active_shards" : 9,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 6,
"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" : 60.0
}
```
运行命令:
```shell
[root@VM_0_4_centos ~]# curl -H "Content-Type: application/json" -XPUT 'http://localhost:9200/_settings' -d '
> {
> "index" : {
> "number_of_replicas" : 0
> }
> }'
{"acknowledged":true}
```
检查运行是否成功:
----------
```shell
[root@VM_0_4_centos ~]# curl 'localhost:9200/_cat/indices?v'
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
green open .kibana eexQJ9RSQu6UgwvtrHmujw 1 0 17 1 49.2kb 49.2kb
green open .monitoring-kibana-6-2018.09.22 GJNtqDtfRPGOHCNiuKxqmg 1 0 3313 0 919.7kb 919.7kb
green open articles kLEiHHw6Rk67GynPFOF82w 5 0 5 0 98.4kb 98.4kb
green open apm-6.4.1-onboarding-2018.09.22 H4cZ6-cASFytVL8J8oADoQ 1 0 1 0 5.9kb 5.9kb
green open .monitoring-es-6-2018.09.22 cDhB2cu0Snm40EANHZDh_Q 1 0 33167 87 13.3mb 13.3mb
```
elasticsearch中的health全都为yellow
本文介绍了一种常见的Elasticsearch集群健康状态显示为黄色的问题及其解决方案。通过设置索引副本数量为0,可以暂时提升集群健康状态至绿色,从而避免因黄色健康状态可能引发的数据写入等问题。





