前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >单机版es中index状态为yellow问题处理

单机版es中index状态为yellow问题处理

作者头像
IT小马哥
发布2023-10-08 08:30:03
5130
发布2023-10-08 08:30:03
举报
文章被收录于专栏:Java TaleJava Tale

查询es中index状态

代码语言:javascript
复制
 curl  -X GET  -u  username:password    http://xx.xx.xx.xx:9200/_cluster/health?pretty
{
  "cluster_name" : "es7",
  "status" : "yellow"
}
代码语言:javascript
复制
$ curl  -u username:password    http://xx.xx.xx.xx:9200/_cat/indices
 
yellow open index01    1NCeOgzbQIqIX_OFUv-WTg 3 1   5   1  31.7kb  31.7kb
green  open index02    -ug5H9CWS66n2_Q3_tGoiQ 3 0   0   0    624b    624b
yellow open index03    WHBtQw_tRuOKN05oyPwf9w 1 1  24   7 174.8kb 174.8kb
yellow open index04    tIWbmSlOToOBSoXDp45PgQ 5 1 141 466 421.1kb 421.1kb

ES index状态为yellow状态原因

索引初始化脚本中,设置的 索引的分片副本数为 1 ,而单机版es,索引的分片副本无处安放,导致索引/集群状态为 yellow

处理办法

将相关索引的分片副本数改为0

注意:此管理操作需要使用es集群的 管理员账号

代码语言:javascript
复制
curl -XPUT  'http://xx.xx.xx.xx:9200/${index_name}/_settings' \
 -H 'Content-Type: application/json' \
 -u  username:password   \
-d '{
    "index" : {
               "number_of_replicas": 0
    }
}'

验证

代码语言:javascript
复制
curl  -X GET -s   -u  username:password   http://xx.xx.xx.xx:9200/_cluster/health?pretty

{
  "cluster_name" : "es7",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 13,
  "active_shards" : 13,
  "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
}
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 查询es中index状态
  • ES index状态为yellow状态原因
  • 处理办法
  • 验证
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档