注:
下面省略部分……均为${username}:${password}@${ip}:${port}
${username}-用户名,${password}-密码,${ip}-实际ip,${port}-实际端口
1、查看日志:进入es的logs目录,查看my-application.log,对应修改
实例:
1.1、出现内存问题which is larger than the limit of [31513988300/29.3gb],修改参数亲测可用:
# 缓存回收大小,无默认值
# 有了这个设置,最久未使用(LRU)的 fielddata 会被回收为新数据腾出空间
# 控制fielddata允许内存大小,达到HEAP 20% 自动清理旧cache
indices.fielddata.cache.size: 20%
indices.breaker.total.use_real_memory: false
# fielddata 断路器默认设置堆的 60% 作为 fielddata 大小的上限。
indices.breaker.fielddata.limit: 40%
# request 断路器估算需要完成其他请求部分的结构大小,例如创建一个聚合桶,默认限制是堆内存的 40%。
indices.breaker.request.limit: 40%
# total 揉合 request 和 fielddata 断路器保证两者组合起来不会使用超过堆内存的 70%(默认值)。
indices.breaker.total.limit: 95%
1.2、频繁出现分配失败并且日志有报错shard has exceeded the maximum number of retries [5] on failed allocation……,通过explain查看分片失败原因只有一个建议你手动执行reroute,但经常这样也不是办法,建议将分片重试次数调大,比如:
curl -XPUT ……/{indices}/_settings -H 'Content-type:application/json' -d '{"index.allocation.max_retries":23}'
2、查看集群索引状态:curl -XGET ……/_cluster/health?pretty&level=indices
2.1、如果status为green则无误;
2.2、为yellow则有问题;
3、如果集群为yellow,查看各分片状态:curl -XGET ……/_cat/shards?h=index,shard,prirep,state,unassigned.reason
3.1、如果有UNASSIGNED,查看未分片原因:curl -XGET ……/_cluster/allocation/explain,根据对应原因调整参数或者进行重分片:curl -XPOST ……/_cluster/reroute?retry_failed=true;
3.2、如果在INITIALIAZING ASSIGNED或者MANUAL ASSIGNED,代表情况暂时正常,说明正在进行分配