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

相关推荐
h***67372 小时前
SpringBoot整合easy-es
spring boot·后端·elasticsearch
2501_941623327 小时前
人工智能赋能智慧农业互联网应用:智能种植、农业数据分析与产量优化实践探索》
大数据·人工智能
YangYang9YangYan8 小时前
网络安全专业职业能力认证发展路径指南
大数据·人工智能·安全·web安全
小五传输9 小时前
常用的文件摆渡系统:让数据安全高效跨越网络界限
大数据·运维·安全
数据科学小丫12 小时前
数据分析与FineBI介绍
大数据·数据分析·finebi
ALex_zry12 小时前
Git大型仓库推送失败问题完整解决方案
大数据·git·elasticsearch
二进制coder13 小时前
Git Fork 开发全流程教程
大数据·git·elasticsearch
天硕国产存储技术站17 小时前
DualPLP 双重掉电保护赋能 天硕工业级SSD筑牢关键领域安全存储方案
大数据·人工智能·安全·固态硬盘
雷文成.思泉软件17 小时前
以ERP为核心、企微为门户,实现一体化集成
大数据·低代码·创业创新
东哥说-MES|从入门到精通19 小时前
数字化部分内容 | 十四五年规划和2035年远景目标纲要(新华社正式版)
大数据·人工智能·数字化转型·mes·数字化工厂·2035·十四五规划