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

相关推荐
Yz98766 小时前
Hive的基础函数-日期函数
大数据·数据仓库·hive·hadoop·sql·数据库架构·big data
Mephisto.java8 小时前
【大数据学习 | Spark-Core】详解Spark的Shuffle阶段
大数据·学习·spark
FreeIPCC8 小时前
电话机器人是什么?
大数据·人工智能·语言模型·机器人·开源·信息与通信
Tianyanxiao8 小时前
【探商宝】大数据获客平台在销售型企业中的应用
大数据·经验分享·科技·数据分析
财富探秘者8 小时前
贵州茅台[600519]行情数据接口
大数据·c语言·python·算法·金融·restful
字节数据平台8 小时前
火山引擎数据飞轮探索零售企业大促新场景:下放营销活动权限
大数据·人工智能
jlting19510 小时前
《Linux中软件的两种安装方式》详细步骤
大数据·mysql
傻啦嘿哟10 小时前
Flask项目中PostgreSQL与Elasticsearch的批量更新
elasticsearch·postgresql·flask
King.62411 小时前
sql工具!好用!爱用!
大数据·数据库·人工智能·sql·学习
Jurio.12 小时前
【论文笔记】Large Brain Model (LaBraM, ICLR 2024)
大数据·论文阅读·人工智能·深度学习·数据挖掘