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

相关推荐
是店小二呀4 分钟前
零门槛快速接入主流大模型:基于 AI Ping 平台一键集成 GLM-5.1 与多场景应用深度实战
大数据·数据库·人工智能
YangYang9YangYan5 分钟前
2026学习数据分析对报考大数据专业的价值
大数据·学习·数据分析
oort12312 分钟前
AI+基层治理·智慧政务解决方案——AI民意速办智能助手
大数据·人工智能·算法·政务
逐米时代26 分钟前
为什么制造型企业需要企业知识库建设?
大数据·人工智能
金融Tech趋势派29 分钟前
企业微信私域实现高效增长的3步策略:精准获客+粘性留存+高效转化
大数据·人工智能·企业微信
阿乔外贸日记37 分钟前
摩托品类进军亚美尼亚市场路径分享
大数据·人工智能·智能手机·云计算·汽车
YangYang9YangYan44 分钟前
数据科学与大数据技术专业学习数据分析的价值
大数据·学习·数据分析
元拓数智1 小时前
NL2SQL落地后的“隐形陷阱”:如何破解数据变更引发的查询失效难题
大数据·ai·自然语言处理·nl2sql
专注API从业者1 小时前
告别手动翻页!基于淘宝商品接口 + Open Claw 实现自动化选品与实时监控(附完整 Python 代码)
大数据·运维·数据库·自动化
云中计算巫作坤2 小时前
多平台电商订单,手工同步的时代该结束了
大数据·系统集成·s-hub·s-hub电商平台对接