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

相关推荐
阿乔外贸日记15 小时前
美国买家资产包装套路与应收款尽调框架,580万应收账款案例解析
大数据·服务器·人工智能·microsoft·云计算
小羊没烦恼!15 小时前
在.net中读写config文件的各种方法
java·大数据·运维·服务器·前端·数据库·oracle
scaryFann15 小时前
职责半径与交接契约:企业智能体团队的边界建模方法
大数据·人工智能
zhixingheyi_tian15 小时前
Spark Configuration 与 AI
大数据
骑着蜗牛撵大象32715 小时前
Spring AI + Qwen3.8 周报助手:从事项采集到人工确认卡的闭环实战
人工智能·spring·elasticsearch·自动化·大模型应用·qwen3.8·rag溯源
Pocker_Spades_A16 小时前
论文精读(十四):基于先验地图的视觉重定位方法综述:启元机器人“知道自己在哪“的底层能力
大数据·人工智能·机器人
leoZ23116 小时前
第 31 篇 金融与医疗:高合规行业的 AI 产品方法论
大数据·人工智能·金融·大模型·agent
阿明副业观察16 小时前
AI短剧分镜秘籍:从零到电影级视觉冲击
大数据·人工智能·aigc·音视频·ai写作
Leo.yuan16 小时前
2026穿透式监管系统选型避坑:数据接不进、风险穿不透、系统难联动,哪些平台能解决?
大数据·数据库
Elastic 中国社区官方博客17 小时前
教程:监控 Java 应用
java·开发语言·数据库·elasticsearch·搜索引擎·全文检索