首页 > 其他 > 详细

索引yellow 分片 UNASSIGNED 解决方案1

时间:2020-08-21 17:37:16      阅读:104      评论:0      收藏:0      [点我收藏+]
  • 环境 ElasticSearch5.x

产生unassigned shards的原因

只有一台机器,跑了es,但是你却在index中的settings中设置了replica为1,显然这个replica shard就会成为unassigned shards
而且你在查看原因的时候,其会显示
the shard cannot be allocated to the same node on which a copy of the shard already exists
即分片不能分配到已经存在分片副本的同一节点

如何解决

  1. GET /_cat/shards/dbaudit-2020.08.19?v&format=json&pretty
[
  {
    "index": "dbaudit-2020.08.19",
    "shard": "1",
    "prirep": "p",
    "state": "STARTED",
    "docs": "690",
    "store": "170.8kb",
    "ip": "10.47.211.100",
    "node": "node-1"
  },
  {
    "index": "dbaudit-2020.08.19",
    "shard": "1",
    "prirep": "r",
    "state": "UNASSIGNED",
    "docs": null,
    "store": null,
    "ip": null,
    "node": null
  },
  {
    "index": "dbaudit-2020.08.19",
    "shard": "2",
    "prirep": "p",
    "state": "STARTED",
    "docs": "729",
    "store": "169.7kb",
    "ip": "10.47.211.100",
    "node": "node-1"
  },
  {
    "index": "dbaudit-2020.08.19",
    "shard": "2",
    "prirep": "r",
    "state": "UNASSIGNED",
    "docs": null,
    "store": null,
    "ip": null,
    "node": null
  },
  {
    "index": "dbaudit-2020.08.19",
    "shard": "0",
    "prirep": "p",
    "state": "STARTED",
    "docs": "668",
    "store": "160.5kb",
    "ip": "10.47.211.100",
    "node": "node-1"
  },
  {
    "index": "dbaudit-2020.08.19",
    "shard": "0",
    "prirep": "r",
    "state": "UNASSIGNED",
    "docs": null,
    "store": null,
    "ip": null,
    "node": null
  }
]
  1. 把副本分片设置为0
PUT /dbaudit-2020.07.19/_settings
{
  "number_of_replicas": 0
}

参考

如何处理elastic search中的unassigned shards?
How to resolve unassigned shards in Elasticsearch

索引yellow 分片 UNASSIGNED 解决方案1

原文:https://www.cnblogs.com/zendwang/p/how_to_resolve_unassigned_shards_in_es.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!