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

问题解决(两种方法)

相关推荐
2401_841495646 分钟前
【数据结构】最长的最短路径的求解
java·数据结构·c++·python·算法·最短路径·图搜索
流浪大叔15 分钟前
Python下载实战技巧的技术文章大纲
开发语言·python
最好束手就擒22 分钟前
Elasticsearch批量写入50万数据
大数据·elasticsearch·jenkins
用户685453759776922 分钟前
🎯 Python迭代器与生成器:从入门到"哦原来如此!"
python
开心-开心急了25 分钟前
PySide6 使用搜索引擎搜索 多类实现 更新1次
python·pyqt·pyside
在未来等你28 分钟前
Elasticsearch面试精讲 Day 25:Elasticsearch SQL与数据分析
大数据·分布式·elasticsearch·搜索引擎·面试
万粉变现经纪人30 分钟前
如何解决 pip install -r requirements.txt 子目录可编辑安装缺少 pyproject.toml 问题
开发语言·python·scrapy·beautifulsoup·scikit-learn·matplotlib·pip
Blossom.11836 分钟前
把 AI“缝”进布里:生成式编织神经网络让布料自带摄像头
人工智能·python·单片机·深度学习·神经网络·目标检测·机器学习
滑水滑成滑头1 小时前
**点云处理:发散创新,探索前沿技术**随着科技的飞速发展,点云处理技术在计算机视觉、自动驾驶、虚拟现实等领域的应用愈发广
java·python·科技·计算机视觉·自动驾驶
gc_22991 小时前
学习Python中Selenium模块的基本用法(19:操作下拉框)
python·selenium