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

相关推荐
深圳市恒星物联科技有限公司1 小时前
水质流量监测仪:复合指标监测的管网智能感知设备
大数据·网络·人工智能
是做服装的同学2 小时前
如何选择适合的服装企业ERP系统才能提升业务效率?
大数据·经验分享·其他
藦卡机器人3 小时前
国产机械臂做的比较好的品牌有哪些?
大数据·数据库·人工智能
代码改善世界3 小时前
CANN深度解构:中国AI系统软件的原创性突破与架构创新
大数据·人工智能·架构
java-yi4 小时前
Elasticsearch(ES)核心用法与实战技巧分享
大数据·elasticsearch·搜索引擎
星辰_mya4 小时前
Es之脑裂
大数据·elasticsearch·搜索引擎
搞科研的小刘选手4 小时前
【EI稳定检索会议】第七届计算机信息和大数据应用国际学术会议(CIBDA 2026)
大数据·acm·学术会议·计算机工程·计算机信息·大数据应用·信息与技术
成长之路5145 小时前
【数据集】地级市公共安全基建省内横向压力(2015-2025)
大数据
YangYang9YangYan5 小时前
2026中专大数据专业学习指南
大数据