ElasticSearch常见错误整理 5.5.x

1.EsRejectedExecutionException

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 在末尾加上 
                       threadpool:
                       bulk:
                       type: fixed
                      size: 60
                      queue_size: 1000
                   重新启动服务即可


2.DocumentMissingException

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


https://blog.csdn.net/github_38395241/article/details/77198744

猜你喜欢

转载自blog.csdn.net/CenturyBole/article/details/80536488