ElasticSearch 7.x现网运行问题汇集1

问题描述:

现网ElasticSearch health状态变为red,有分片无法assign。如下摘录explain的结果部分:

复制代码
    "note": "No shard was specified in the explain API request, so this response explains a randomly chosen unassigned shard. There may be other unassigned shards in this cluster which cannot be assigned for different reasons. It may not be possible to assign this shard until one of the other shards is assigned correctly. To explain the allocation of other shards (whether assigned or unassigned) you must specify the target shard in the request to this API.",
    "index": "demo-2022.02.06",
    "shard": 3,
    "primary": true,
    "current_state": "unassigned",
    "unassigned_info": {
        "reason": "CLUSTER_RECOVERED",
        "at": "2023-05-29T08:08:22.697Z",
        "last_allocation_status": "no_valid_shard_copy"
    },
    "can_allocate": "no_valid_shard_copy",
    "allocate_explanation": "cannot allocate because all found copies of the shard are either stale or corrupt",
。。。
"store": {
                "in_sync": true,
                "allocation_id": "82iRvG0KTTm9NT_5Fx8BRA",
                "store_exception": {
                    "type": "corrupt_index_exception",
                    "reason": "failed engine (reason: [corrupt file (source: [start])]) (resource=preexisting_corruption)",
                    "caused_by": {
                        "type": "i_o_exception",
                        "reason": "failed engine (reason: [corrupt file (source: [start])])",
                        "caused_by": {
                            "type": "corrupt_index_exception",
                            "reason": "checksum passed (d87020fd). possibly transient resource issue, or a Lucene or JVM bug (resource=BufferedChecksumIndexInput(NIOFSIndexInput(path=\"/data/es/data/nodes/0/indices/dzcoAoZjSzGus0qj1sKTFg/3/index/segments_6\")))"
                        }
                    }
                }
            }

解决方案:

  1. 步骤1: 检查shard stores

GET /_shard_stores?pretty ,得到分片损坏的明细,以便进行修复,得到如图:

  1. 步骤2: reroute index

    POST /_cluster/reroute?master_timeout=5m
    {
    "commands": [
    {
    "allocate_empty_primary": {
    "index": "demo-2023.04.04",
    "shard": 2 ,
    "node": "{nodename}",
    "accept_data_loss": true
    }
    }
    ]
    }

相关推荐
大大大大晴天11 小时前
从 HDFS 到对象存储:计算存储分离如何重塑云原生大数据底座
大数据
阿里云大数据AI技术11 小时前
Agentic Search 2.0:从单轮对话迈向企业级 AI 搜索自动驾驶Agent
人工智能·elasticsearch·agent
Elasticsearch14 小时前
你的 AI agent 需要一个不在场证明:Elastic 中 Agent Builder 的可观测性和审计追踪
elasticsearch
Elasticsearch18 小时前
仪表板活动日志:了解哪些 Kibana 仪表板会被使用
elasticsearch
用户36105886261220 小时前
SparkStreaming 之 updateStateByKey 算子详解及代码实现
大数据·spark
咖啡屋和酒吧21 小时前
“隐性肩颈紧张”正在透支精力|没有酸痛,不代表肩颈处于健康状态
大数据·精选
港股研究社1 天前
专注履约底座,顺丰同城在即时零售效率时代提升增长动能
大数据·人工智能
AI_yangxi1 天前
短视频矩阵系统选哪家
大数据·人工智能·矩阵
lupai1 天前
手机在网状态接口实测效果与质量评估
大数据·python·智能手机·api接口
大模型丫丫1 天前
Hermes Agent:轻量级智能体框架实战指南
大数据·运维·服务器