1、索引只读

官方文档

all indices on this node will be marked read-only
FORBIDDEN/12/index read-only / allow delete (api)

原因:
磁盘空间不够,df -h查看磁盘空间,发现使用了95%,es默认达到95%就全都设置只读
解决

# cluster.routing.allocation.disk.watermark.flood_stage控制洪水阶段水印。默认为95%
PUT _cluster/settings
{
  "transient": {
    "cluster.routing.allocation.disk.watermark.low": "100gb",
    "cluster.routing.allocation.disk.watermark.high": "50gb",
    "cluster.routing.allocation.disk.watermark.flood_stage": 98%,
    "cluster.info.update.interval": "1m"
  }
}

如果磁盘够了之后需要手动释放(每个索引都要释放)

PUT /_all/_settings
{
  "index.blocks.read_only_allow_delete": null
}

变更磁盘

vim /elasticsearch/elasticsearch.yml
path.data: /media/qxj/data/es/data
path.logs: /media/qxj/data/es/logs

现有文件copy过去即可
或者增加硬盘

path.data : /opt/data1,/opt/data2

记得删除elasticsearch/config/elasticsearch.keystore

2、NoSpamLogger.java:91 log Maximum memory usage reached (536870912), cannot allocate chunk of 1048576

vim cassandra.yaml
file_cache_size_in_mb: 5120 #默认大小为 512 MB

3、ES索引java.lang.Double cannot be cast to java.lang.Float

需求:增加地理位置信息查询索引location,之前的location为数组索引

"location": {
"type": "geo_point"
}
{
    "error": {
        "root_cause": [
            {
                "type": "remote_transport_exception",
                "reason": "[127.0.0.1][127.0.0.1:9300][indices:data/write/bulk[s][p]]"
            }
        ],
        "type": "class_cast_exception",
        "reason": "java.lang.Double cannot be cast to java.lang.Float"
    },
    "status": 500
}

原因:重建索引需删除索引+删除Cassandra表,然后创建ES索引,由于未删除Cassandra表导致。

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐