问题记录
illegal_argument_exception [indices:admin/create]
问题日志
1 | [2020-08-04 23:15:22,145] PID:7703-elasticsearch: [base.py-log_request_fail-244] WARNING: PUT http://192.168.101.73:9200/cust-daily-2010-08-06 [status:400 request:0.057s] |
解决方案
1 | # ES数据清空后,此设置会丢失。 |
search.max_open_scroll_context
错误信息
1 | Trying to create too many scroll contexts. Must be less than or equal to: [500]. This limit can be set by changing the [search.max_open_scroll_context] setting |
解决方案
1 | # ES数据清空后,此设置会丢失。 |
1 | # 运行样例 |
driver failed programming external connectivity on endpoint
centos7.6,启动 docker 后,关闭防火墙,再开启容器导致此问题
重启 docker 服务即可解决问题
1 | [fdm@data1 es]$ docker-compose -f 21-es-docker-compose.yml up -d |
Elasticsearch is still initializing the Monitoring indices
1 | # 删除监控索引, 重启 Kibana 即可 |
Shard UNASSIGNED 修复(常见问题)
背景介绍
- 大数据量的 ES 集群中,对节点做配置更新或增减集群(未关闭节点自动均衡),或者出现节点异常情况时,会发生此问题。
获取集群状态
1 | [fdm@data1 ~]$ curl -XGET http://172.16.2.1:9200/_cluster/health\?pretty |
解决方案
1 | # 方法1 |
总结
在做集群更新时,务必先关闭集群的自动均衡
1 | # 停止集群自动分配 |
1.EsRejectedExecutionException
1 | error: failure in bulk execution:[4]: index [teacher.tis1.teacher], type [teacher_comment], id [1265687], message [RemoteTransportException[[node-1][192.168.4.30:9300][indices:data/write/bulk[s][p]]]; nested: EsRejectedExecutionException[rejected execution of org.elasticsearch.transport.TransportService$7@5f21ed47 on EsThreadPoolExecutor[bulk, queue capacity = 50, org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor@18160e59[Running, pool size = 4, active threads = 4, queued tasks = 50, completed tasks = 6362]]];] |
原因: 说明 ES 索引数据的速度已经跟不上 client 端发送 bulk 请求的速度,请求队列已满以致开始拒绝新的请求。 这是 ES 集群的自我保护机制。可以适当睡眠一段时间或者将队列设置大点。默认设置是 bulk thead pool set queue capacity =50 可以设置大点。
解决办法:打开 elasticsearch.yml 在末尾加上
1 | threadpool: |
重新启动服务即可
2.DocumentMissingException
1 | error: [[teacher.tis1.teacher/YudbzduURsGhxHMRzyfNcA][teacher.tis1.teacher][1]] DocumentMissingException[[teacher][344]: document missing]] |
原因: 找不到文档,可能是索引(index)或者类型(type)名称错误导致找不到文档,或者文档记录不存在时更新索引则报错。比如:更新 id 为 414 的记录,而此时 ES 中不存在 id 为 414 记录的数据,则抛出此异常
解决办法:
1.检查索引(index)名称是否正确 2.检查类型(type)名称是否正确 3.记录不存在时更新索引则报错 可以在更新索引是使用 upsert 属性,如果不存在则进行创建。代码如下:
IndexRequest indexRequest = new IndexRequest(index, type, id).source(jsonSource);
UpdateRequest updateRequest = new UpdateRequest(index, type, id).doc(jsonSource).upsert(indexRequest);3.RemoteTransportException:
error: org.elasticsearch.transport.RemoteTransportException: Failed to deserialize exception response from stream
原因: es 节点之间的 JDK 版本不一样
解决办法:统一 JDK 环境
4.NoNodeAvailableException:
error: org.elasticsearch.client.transport.NoNodeAvailableException: No node available
原因: 节点不可用,
(1) es client 与 java client 的版本不一致
(2)端口号错误
(3)集群名字错误
(4)jar 包引用版本不匹配
解决办法:
1.检查 es client 与 java client 的版本是否一致 目前我们项目中使用的是 java1.8 对应 es5.5.2 2.检查端口号是否正确 使用 client 连接应使用 es 的 transport 端口号 3.检查集群名称是否正确 4.检查 es 与 es client 的版本号是否一致 目前我们项目中使用的均为 5.5.2