elasticsearch索引health 健康状态变为yellow,red处理

查看所有索引健康状态

[root@test3 ~]# curl -X GET "192.168.1.77:30308/_cat/indices/?v"
health status index              uuid                   pri rep docs.count docs.deleted store.size pri.store.size
yellow open   ticket             dr8eZlOlT-i_lhnSK27i4Q   1   1     290322            0     51.1mb         51.1mb
yellow open   line_goods3        3xPiCrdhSdiiZmnWhFBiiw   5   1          0            0      1.2kb          1.2kb
yellow open   car                KOhywWXoSByM7gK3CsKMhA   1   1          4            0      6.6kb          6.6kb
red    open   line_goods4        q5CUCDZsRV2xCi7cTayQtw   5   1                                                  
yellow open   line               wGM3N3EkTbSk0XUV7ERGaQ   1   1        171           93    188.9kb        188.9kb
yellow open   station_line       Xo6GXcb2TVy8vX9vUKPlVg   1   1          0            0     35.5kb         35.5kb
yellow open   consumer_elastic   49pM0NitRn-r7Mzc9FUj3g   1   1     284935            0     23.1mb         23.1mb
yellow open   bill               NfbZJu-hQcquRIgAEythuQ   1   1    1770644        71844      1.3gb          1.3gb
yellow open   station_liner_trip 3MRuerp5TFKqTjyaONf6Bg   1   1          0            0      7.2mb          7.2mb
yellow open   liner_trip         A-qgXqDZS5Sg6hZ4OQWxUA   1   1          0            0     82.9mb         82.9mb
yellow open   liner              IY9JoPz3RFmBxMqv1M2sEw   1   1     121269          487     21.4mb         21.4mb
yellow open   food               CWrtkiOLT8mzhlSeC9nY_g   1   1          4            0     14.2kb         14.2kb

看到所有索引都出现yellow,red

1.绿色——最健康的状态,代表所有的主分片和副本分片都可用;
2 黄色——所有的主分片可用,但是部分副本分片不可用;
3 红色——部分主分片不可用。(此时执行查询部分数据仍然可以查到,遇到这种情况,还是赶快解决比较好。)

解决health为red,yellow

1 查看集群状态

[root@test ~]# curl -X GET "192.168.1.77:30308/_cluster/health?pretty"
{
    "cluster_name": "my-es",
    "status": "red",
    "timed_out": false,
    "number_of_nodes": 1,
    "number_of_data_nodes": 1,
    "active_primary_shards": 15,
    "active_shards": 15,
    "relocating_shards": 0,
    "initializing_shards": 0,
    "unassigned_shards": 25,
    "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": 37.5
}

从上面的 unassigned_shards 可以存在大量分片没有被分配,当时看到的实际有25个。

通过如果下命令,设置number_of_replicas=0,将副本调整为0

[root@test3 ~]# curl -X PUT "192.168.1.77:30308/_settings" -H 'Content-Type: application/json' -d'{"number_of_replicas":0}'
{"acknowledged":true}
#再次查询所有索引健康状态 全变为green
[root@test3 ~]# curl -X GET "192.168.1.77:30308/_cat/indices/?v"
health status index              uuid                   pri rep docs.count docs.deleted store.size pri.store.size
green  open   ticket             dr8eZlOlT-i_lhnSK27i4Q   1   0     290322            0     51.1mb         51.1mb
green  open   line_goods3        3xPiCrdhSdiiZmnWhFBiiw   5   0          0            0      1.2kb          1.2kb
green  open   line_goods4        MtzapfSFQaimBrJmiX1GWQ   1   0          0            0       208b           208b
green  open   car                KOhywWXoSByM7gK3CsKMhA   1   0          4            0      6.6kb          6.6kb
green  open   line               wGM3N3EkTbSk0XUV7ERGaQ   1   0        171           93    188.9kb        188.9kb
green  open   station_line       Xo6GXcb2TVy8vX9vUKPlVg   1   0          0            0     35.5kb         35.5kb
green  open   bill               NfbZJu-hQcquRIgAEythuQ   1   0    1770644        71844      1.3gb          1.3gb
green  open   consumer_elastic   49pM0NitRn-r7Mzc9FUj3g   1   0     284935            0     23.1mb         23.1mb
green  open   liner_trip         A-qgXqDZS5Sg6hZ4OQWxUA   1   0          0            0     82.9mb         82.9mb
green  open   station_liner_trip 3MRuerp5TFKqTjyaONf6Bg   1   0          0            0      7.2mb          7.2mb
green  open   liner              IY9JoPz3RFmBxMqv1M2sEw   1   0     121269          487     21.4mb         21.4mb
green  open   food               CWrtkiOLT8mzhlSeC9nY_g   1   0          4            0     14.2kb         14.2kb

你可能感兴趣的:(elasticsearch,大数据,搜索引擎)