ElasticSearch 创建索引超时(ReadTimeoutError)

报错现象

在 Python 中调用 client.indices.create 来创建 ElasticSearch 索引时,报如下错误:

python 复制代码
elastic_transport.transport - INFO - PUT http://127.0.0.1:9200/document_page?timeout=60s [status:N/A duration:10.011s]
elastic_transport.node_pool - WARNING - Node <Urllib3HttpNode(http://127.0.0.1:9200)> has failed for 1 times in a row, putting on 1 second timeout
elastic_transport.transport - WARNING - Retrying request after failure (attempt 0 of 3)
Traceback (most recent call last):
  File "C:\Users\15797\.conda\envs\ppkg\lib\site-packages\elastic_transport\_transport.py", line 329, in perform_request
    meta, raw_data = node.perform_request(
  File "C:\Users\15797\.conda\envs\ppkg\lib\site-packages\elastic_transport\_node\_http_urllib3.py", line 199, in perform_request
    raise err from None
elastic_transport.ConnectionTimeout: Connection timeout caused by: ReadTimeoutError(HTTPConnectionPool(host='127.0.0.1', port=9200): Read timed out. (read timeout=10.0))

问题分析

在查阅网络资料时,一开始以为是字面意思上的连接超时问题,但调大 timeout 参数也一样报错,而且之前用相同方法创建类似索引时并未出现该问题。

最后,受博文(https://blog.csdn.net/ckq707718837/article/details/136215814)的启发,查看 ElasticSearch 的日志(如下所示),才发现问题所在:电脑磁盘快满了,ES 自动把索引的状态由黄转红,变成只读状态,无法写入

elasticsearch.log(节选内容)

python 复制代码
current.health="RED" message="Cluster health status changed from [YELLOW] to [RED] (reason: [reconcile-desired-balance])." previous.health="YELLOW" reason="reconcile-desired-balance"

flood stage disk watermark [95%] exceeded on [D:\Softwares\elasticsearch-8.6.0\data] free: 5.8gb[2.1%], all indices on this node will be marked read-only

问题解决(两种方法)

相关推荐
fish_study_csdn4 小时前
pytest 技术总结
开发语言·python·pytest
咖啡调调。5 小时前
使用Django框架表单
后端·python·django
BO_S__5 小时前
python调用ffmpeg对截取视频片段,可批量处理
python·ffmpeg·音视频
程序员沉梦听雨5 小时前
【Elasticsearch】入门篇
大数据·elasticsearch·搜索引擎
就叫飞六吧5 小时前
如何判断你的PyTorch是GPU版还是CPU版?
人工智能·pytorch·python
Gadus_5 小时前
Elasticsearch性能优化实践
大数据·elasticsearch·搜索引擎·性能优化
pyengine6 小时前
基于pandoc的MarkDown格式与word相互转换小工具开发(pyqt5)
开发语言·python·qt·word
YuSun_WK7 小时前
配置MambaIRv2: Attentive State Space Restoration的环境
开发语言·python
Nick_zcy7 小时前
开发基于python的商品推荐系统,前端框架和后端框架的选择比较
开发语言·python·前端框架·flask·fastapi
一点.点7 小时前
李沐动手深度学习(pycharm中运行笔记)——04.数据操作
pytorch·笔记·python·深度学习·pycharm·动手深度学习