Elasticsearch6.4专题之杂记:遇到的异常与解决方案

这个是我实际项目实践过程中遇到过的问题与解决方案;同样的问题,不同的场景可能解决方案不一样,所以,博友们不要硬套,自己验证过后,适合自己的问题再采用。

1、elasticsearch磁盘满导致read-only,新数据不可入库

执行
curl -XPUT -H "Content-Type: application/json" http://127.0.0.1:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'

解除lock状态,即使更换磁盘也需要执行该命令

2、ES单机状态内存配置32G最大处理文档数据量为118亿,每条文档平均大小1.4K,占用磁盘空间16T数据。?尚存在疑问!

这个是我在项目实际运行过程遇到过一次,后续没有在没有遇到,所以我标记为尚存在疑问

3、删除一个不存在的索引

返回 no such index Exception

4、查询一个不存在的索引的mapping、setting、别名

返回 no such index Exception

5、往一个不存在的索引插入数据
自动创建索引和相应的mapping,并不会报任何异常

6、假设一个索引原来是5个shards,插入一批数据后,我现在要把这个索引改为3个shard,或者增加为8个shards,这个变换过程中副本数不变。

shards不可更改,如果强行更改setting,报异常illegal_argument_exception  ;必须更改using the _shrink and _split APIs。比较麻烦耗时

7、Each Elasticsearch shard is a Lucene index. There is a maximum number of documents you can have in a single Lucene index. As of LUCENE-5843, the limit is 2,147,483,519 (= Integer.MAX_VALUE - 128) documents. You can monitor shard sizes using the _cat/shards API.

经验证上述是正确的。超过上限在插数据报
java.lang.IllegalArgumentException: number of documents in the index cannot exceed 2147483519

8、[WARN ][o.e.d.z.ZenDiscovery ] [node3.com] not enough master nodes discovered during pinging (found [[Candidate{node={node3.com}{eT19CeA7QNqiXaZ2VUbzkQ}{-Z5iQbEARPGsQLCVDWdL6w}{192.168.8.127}{192.168.8.127:9300}{ml.machine_memory=1019797504, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}, clusterStateVersion=-1}]], but needed [2]), pinging again

这个集群模式下的通信出现了问题,可能是selinux或者防火墙的原因。

9、出现 java.lang.IllegalArgumentException: Limit of total fields [1000] in index [eventaction_20190708] has been exceeded 的问题
解决方案:

PUT apievent_20190619/_settings
{
  "index.mapping.total_fields.limit": 2000
}
或
curl -XPUT "http://127.0.0.1:9200/apievent_20190827/_settings" -H 'Content-Type: application/json' -d'
{
  "index.mapping.total_fields.limit": 2000
}'

10、安装nlpchina elasticsearch-sql时如果kibana和xpack后,在页面执行sql语句报错
Error:Error occured! response is not avalible.

解决方案:
修改elasticsearch配置文件,添加cors和xpack:

http.cors.enabled: true
http.cors.allow-credentials: true
http.cors.allow-origin: "/.*/"
http.cors.allow-headers: WWW-Authenticate,X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization
pack.security.enabled: false
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

风吹千里

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值