只有一台机器,跑了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
即分片不能分配到已经存在分片副本的同一节点
[
{
"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
}
]
PUT /dbaudit-2020.07.19/_settings
{
"number_of_replicas": 0
}
如何处理elastic search中的unassigned shards?
How to resolve unassigned shards in Elasticsearch
原文:https://www.cnblogs.com/zendwang/p/how_to_resolve_unassigned_shards_in_es.html