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
    }
    }
    ]
    }

相关推荐
QYR_1126 分钟前
香叶醇行业深度解析:香精香料领域核心原料的发展潜力与挑战
大数据·人工智能·物联网
catchadmin2 小时前
保姆级 OpenClaw (原 Clawdbot)飞书对接教程 手把手教你搭建 AI 助手
人工智能·elasticsearch·飞书
港股研究社3 小时前
腾讯音乐的多元增长新路径:音乐IP经济
大数据·人工智能·tcp/ip
GIOTTO情3 小时前
技术解析:Infoseek基于AI重构媒介投放全链路,适配2026年奥斯卡高端投放场景
大数据·人工智能
Data-Miner3 小时前
46页精品PPT | 数据治理大数据平台资源规划与建设解决方案
大数据
信道者3 小时前
乌克兰开放战场数据宝库:AI无人机迎来“实战级”进化
大数据·人工智能·无人机
margu_1683 小时前
【Elasticsearch】es7.2单节点集群内索引重组迁移
大数据·elasticsearch
武子康3 小时前
大数据-251 离线数仓 - Airflow 安装部署避坑指南:1.10.11 与 2.x 命令差异、MySQL 配置与错误排查
大数据·后端·apache hive
Elastic 中国社区官方博客4 小时前
用于 Elasticsearch 的 Gemini CLI 扩展,包含工具和技能
大数据·开发语言·人工智能·elasticsearch·搜索引擎·全文检索