gpt4 book ai didi

amazon-web-services - ElasticSearch 节点故障

转载 作者:行者123 更新时间:2023-12-02 23:49:19 24 4
gpt4 key购买 nike

我的 Elasticsearch 集群从 2B 文档减少到 900M 记录,在 AWS 上显示

Relocating shards: 4


显示时

Active Shards: 35



Active primary shards: 34


(可能不相关,但这是其余的统计数据):

Number of nodes: 9

Number of data nodes: 6

Unassigned shards: 17


运行时
GET /_cluster/allocation/explain
它返回:
{
"index": "datauwu",
"shard": 6,
"primary": true,
"current_state": "unassigned",
"unassigned_info": {
"reason": "NODE_LEFT",
"at": "2019-10-31T17:02:11.258Z",
"details": "node_left[removedforsecuritybecimparanoid1]",
"last_allocation_status": "no_valid_shard_copy"
},
"can_allocate": "no_valid_shard_copy",
"allocate_explanation": "cannot allocate because a previous copy of the primary shard existed but can no longer be found on the nodes in the cluster",
"node_allocation_decisions": [
{
"node_id": "removedforsecuritybecimparanoid2",
"node_name": "removedforsecuritybecimparanoid2",
"node_decision": "no",
"store": {
"found": false
}
},
{
"node_id": "removedforsecuritybecimparanoid3",
"node_name": "removedforsecuritybecimparanoid3",
"node_decision": "no",
"store": {
"found": false
}
},
{
"node_id": "removedforsecuritybecimparanoid4",
"node_name": "removedforsecuritybecimparanoid4",
"node_decision": "no",
"store": {
"found": false
}
},
{
"node_id": "removedforsecuritybecimparanoid5",
"node_name": "removedforsecuritybecimparanoid5",
"node_decision": "no",
"store": {
"found": false
}
},
{
"node_id": "removedforsecuritybecimparanoid6",
"node_name": "removedforsecuritybecimparanoid6",
"node_decision": "no",
"store": {
"found": false
}
},
{
"node_id": "removedforsecuritybecimparanoid7",
"node_name": "removedforsecuritybecimparanoid7",
"node_decision": "no",
"store": {
"found": false
}
}
]
}
我对这到底意味着什么有点困惑,这是否意味着我的 Elasticsearch 集群没有丢失数据,而是将其重新定位到不同的分片中,或者它找不到分片?
如果它找不到分片,这是否意味着我的数据丢失了?如果是这样,可能是什么原因,我怎样才能防止将来发生这种情况?
我在索引数据时没有设置副本,并且在索引时副本会减慢它的速度。
也不是,我的记录数一度下降到 400m,然后随机上升到 900m。我不知道这意味着什么,任何见解将不胜感激。

最佳答案

"reason": "NODE_LEFT"



和:

I haven't setup replicas as i was indexing data, and replicas slow it down whilst indexing.



如果持有主分片的节点已经消失,那么是的,您的数据也消失了。毕竟,如果没有副本,那么如果主(也是唯一的)分片不再是集群的一部分,集群将从哪里检索数据?您要么需要将保存这些分片的节点重新启动并将其添加到集群中,要么数据就会消失。

错误消息是“您希望我为这个我知道存在的索引分配一个主分片,但曾经有另一个版本的主分片无法找到,我不会再分配它以防万一之前的小学回来了。”

您可以通过使用 allocate_stale_primary 执行重新路由来强制 Elasticsearch 重新分配主分片(并明确接受前一个主分片中的数据已消失)。 ( doc ):

curl -XPOST '127.0.0.1:9200/_cluster/reroute?pretty' -d '{
"commands" : [ {
"allocate_stale_primary" :
{
"index" : "datauwu", "shard" : 6,
"node" : "target-data-node-id",
"accept_data_loss" : true
}
}
]
}'

除了使用一次性数据进行开发之外,关闭副本通常是一个坏主意。

also side not, my record count dropped down to 400m at one point but then rose back up to 900m randomly. i don't know what this means and any insight would greatly be appreciated.



发生这种情况是因为分片在集群中不可见。如果正在分配、重新定位或恢复分片的所有副本,就会发生这种情况。这对应于 RED 集群状态。您可以通过确保至少有 1 个副本来缓解它(尽管理想情况下您设置了足够数量的副本,以便在集群中丢失 N 个数据节点后继续存在)。这让 Elasticsearch 将一个分片保留为主分片,同时移动其他分片。

如果您只有主节点而没有副本节点,那么如果主节点正在恢复或重定位,则该分片中的数据在集群中将不可见。一旦分片再次处于事件状态,其中的文档就会变得可见。

关于amazon-web-services - ElasticSearch 节点故障,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58758088/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com