要不要也来分享分享一下啊

python多进程批量建立索引时出现错误异常

Elasticsearch | 作者 qq402424088 | 发布于2017年09月12日 | 阅读数:11168

背景当我使用多进程对多个文件夹同时进行批量建立索引时,出现以下错误
Traceback (most recent call last):
File "/test/linux/util/elasticsearch_util.py", line 211, in <module>
rl = pool.map(index_chile, dir_list)
File "/usr/local/lib/python2.7/multiprocessing/pool.py", line 251, in map
return self.map_async(func, iterable, chunksize).get()
File "/usr/local/lib/python2.7/multiprocessing/pool.py", line 567, in get
raise self._value
elasticsearch.exceptions.ConnectionError: ConnectionError(('Connection aborted.', error(104, 'Connection reset by peer'))) caused by: ProtocolError(('Connection aborted.', error(104, 'Connection reset by peer')))

与服务器内存和cpu有关系么?还是其他什么原因呢?求大佬教下,谢谢啦。
已邀请:

Cheetah

赞同来自: qq402424088

kennywu76 - Wood

赞同来自: qq402424088

python client是通过http协议访问ES集群的,要注意ES对于一次http请求的size有限制http.max_content_length,默认为100MB。  
如果一次bulk发送的内容过多,可能超过限制,也会遇到上面的报错。 可以查一下ES一端的日志是否有对应的内容超长错误。 参考https://www.elastic.co/guide/e ... .html

要回复问题请先登录注册