elasticsearch - Celery具有Elasticsearch结果后端AuthenticationException

标签 elasticsearch celery

如何配置selery以与官方Elasticsearch Docker镜像提供的elasticsearch结果后端一起使用?

现在我得到了这个错误:

/usr/local/lib/python3.5/dist-packages/celery/app/trace.py:542: RuntimeWarning: Exception raised outside body: AuthenticationException(401, 'security_exception', {'status': 401, 'error': {'header': {'WWW-Authenticate': 'Basic realm="security" charset="UTF-8"'}, 'root_cause': [{'header': {'WWW-Authenticate': 'Basic realm="security" charset="UTF-8"'}, 'type': 'security_exception', 'reason': 'missing authentication token for REST request [/recognized_text/default_type]'}], 'type': 'security_exception', 'reason': 'missing authentication token for REST request [/recognized_text/default_type]'}}):
asr_1            | Traceback (most recent call last):
asr_1            |   File "/usr/local/lib/python3.5/dist-packages/celery/app/trace.py", line 427, in trace_task
asr_1            |     uuid, retval, task_request, publish_result,
asr_1            |   File "/usr/local/lib/python3.5/dist-packages/celery/backends/base.py", line 152, in mark_as_done
asr_1            |     self.store_result(task_id, result, state, request=request)
asr_1            |   File "/usr/local/lib/python3.5/dist-packages/celery/backends/base.py", line 309, in store_result
asr_1            |     request=request, **kwargs)
asr_1            |   File "/usr/local/lib/python3.5/dist-packages/celery/backends/base.py", line 652, in _store_result
asr_1            |     self.set(self.get_key_for_task(task_id), self.encode(meta))
asr_1            |   File "/usr/local/lib/python3.5/dist-packages/celery/backends/elasticsearch.py", line 80, in set
asr_1            |     datetime.utcnow().isoformat()[:-3]
asr_1            |   File "/usr/local/lib/python3.5/dist-packages/celery/backends/elasticsearch.py", line 95, in _index
asr_1            |     **kwargs
asr_1            |   File "/usr/local/lib/python3.5/dist-packages/elasticsearch/client/utils.py", line 73, in _wrapped
asr_1            |     return func(*args, params=params, **kwargs)
asr_1            |   File "/usr/local/lib/python3.5/dist-packages/elasticsearch/client/__init__.py", line 300, in index
asr_1            |     _make_path(index, doc_type, id), params=params, body=body)
asr_1            |   File "/usr/local/lib/python3.5/dist-packages/elasticsearch/transport.py", line 318, in perform_request
asr_1            |     status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)
asr_1            |   File "/usr/local/lib/python3.5/dist-packages/elasticsearch/connection/http_urllib3.py", line 128, in perform_request
asr_1            |     self._raise_error(response.status, raw_data)
asr_1            |   File "/usr/local/lib/python3.5/dist-packages/elasticsearch/connection/base.py", line 124, in _raise_error
asr_1            |     raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
asr_1            | elasticsearch.exceptions.AuthenticationException: TransportError(401, 'security_exception', 'missing authentication token for REST request [/recognized_text/default_type]')

版本:
$ pip3 freeze
amqp==2.1.4
billiard==3.5.0.2
celery==4.0.2
elasticsearch==5.3.0
kombu==4.0.2
pytz==2017.2
requests==2.13.0
urllib3==1.20
vine==1.1.3

最佳答案

通过添加env xpack.security.enabled = false来解决

关于elasticsearch - Celery具有Elasticsearch结果后端AuthenticationException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43554437/

相关文章:

elasticsearch - 无法在弹性7.5.1中启动Packetbeat

django - 如何关闭 celery 中的突出显示?

django - 使用 Django REST 框架进行批量插入的最佳设计模式是什么?

java - 如何从 Java 等非 python 语言调用 celery 任务延迟函数?

ruby-on-rails - 如何为Tire构建自定义的to_indexed_json方法?

elasticsearch - Elasticsearch “master_not_discovered_exception” centos

elasticsearch - Elasticsearch:自定义 token 过滤器

java - Spring Data Elasticsearch (4.x) - 在 _source 中使用 @Id 强制 id 字段

python - 基于 Django + Celery 的应用程序的动态(即运行时可配置)日志配置

ruby - 将 Python Celery 作为守护进程运行时无法执行 Ruby 脚本