infiniflow / ragflow

RAGFlow is an open-source RAG (Retrieval-Augmented Generation) engine based on deep document understanding.
https://ragflow.io
Apache License 2.0
22.85k stars 2.24k forks source link

[Bug]: ESConnection ERROR: ELASTICSEARCH = ESConnection() #3063

Open sweetboxwwy opened 2 weeks ago

sweetboxwwy commented 2 weeks ago

Is there an existing issue for the same bug?

Branch name

main

Commit ID

c760f05

Other environment information

ubuntu24

Actual behavior

when I telnet localhost 1200,output the following info

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

Expected behavior

No response

Steps to reproduce

conda activate ragflow
export PYTHONPATH=${pwd}
cd /path/to/ragflow
docker compose -f docker/docker-compose-base.yml -p "ragflow" up -d
bash docker/launch_backend_service.sh

Traceback (most recent call last):
  File "/mnt/d/Projects/ragflow/api/ragflow_server.py", line 26, in <module>
Traceback (most recent call last):
  File "/mnt/d/Projects/ragflow/rag/svr/task_executor.py", line 37, in <module>
    from api.db.services.dialog_service import keyword_extraction, question_proposal
  File "/mnt/d/Projects/ragflow/api/db/services/__init__.py", line 18, in <module>
    from api.apps import app
  File "/mnt/d/Projects/ragflow/api/apps/__init__.py", line 26, in <module>
    from api.db.db_models import close_connection
  File "/mnt/d/Projects/ragflow/api/db/db_models.py", line 33, in <module>
    from .user_service import UserService
  File "/mnt/d/Projects/ragflow/api/db/services/user_service.py", line 22, in <module>
    from api.settings import DATABASE, stat_logger, SECRET_KEY, DATABASE_TYPE
  File "/mnt/d/Projects/ragflow/api/settings.py", line 36, in <module>
    from api.db.db_models import DB, UserTenant
  File "/mnt/d/Projects/ragflow/api/db/db_models.py", line 33, in <module>
    from rag.utils.es_conn import ELASTICSEARCH
  File "/mnt/d/Projects/ragflow/rag/utils/es_conn.py", line 462, in <module>
    from api.settings import DATABASE, stat_logger, SECRET_KEY, DATABASE_TYPE
  File "/mnt/d/Projects/ragflow/api/settings.py", line 36, in <module>
    ELASTICSEARCH = ESConnection()
                    ^^^^^^^^^^^^^^
  File "/mnt/d/Projects/ragflow/rag/utils/__init__.py", line 28, in _singleton
    from rag.utils.es_conn import ELASTICSEARCH
  File "/mnt/d/Projects/ragflow/rag/utils/es_conn.py", line 462, in <module>
    instances[key] = cls(*args, **kw)
                     ^^^^^^^^^^^^^^^^
  File "/mnt/d/Projects/ragflow/rag/utils/es_conn.py", line 21, in __init__
    ELASTICSEARCH = ESConnection()
                    ^^^^^^^^^^^^^^
  File "/mnt/d/Projects/ragflow/rag/utils/__init__.py", line 28, in _singleton
    self.conn()
  File "/mnt/d/Projects/ragflow/rag/utils/es_conn.py", line 36, in conn
    instances[key] = cls(*args, **kw)
                     ^^^^^^^^^^^^^^^^
  File "/mnt/d/Projects/ragflow/rag/utils/es_conn.py", line 21, in __init__
    self.info = self.es.info()
                ^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/ragflow/lib/python3.12/site-packages/elasticsearch/_sync/client/utils.py", line 446, in wrapped
    self.conn()
  File "/mnt/d/Projects/ragflow/rag/utils/es_conn.py", line 36, in conn
    return api(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/ragflow/lib/python3.12/site-packages/elasticsearch/_sync/client/__init__.py", line 2464, in info
    return self.perform_request(  # type: ignore[return-value]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/ragflow/lib/python3.12/site-packages/elasticsearch/_sync/client/_base.py", line 271, in perform_request
    response = self._perform_request(
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/ragflow/lib/python3.12/site-packages/elasticsearch/_sync/client/_base.py", line 316, in _perform_request
    meta, resp_body = self.transport.perform_request(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/ragflow/lib/python3.12/site-packages/elastic_transport/_transport.py", line 342, in perform_request
    resp = node.perform_request(
           ^^^^^^^^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/ragflow/lib/python3.12/site-packages/elastic_transport/_node/_http_urllib3.py", line 167, in perform_request
    response = self.pool.urlopen(
               ^^^^^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/ragflow/lib/python3.12/site-packages/urllib3/connectionpool.py", line 789, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/ragflow/lib/python3.12/site-packages/urllib3/connectionpool.py", line 495, in _make_request
    conn.request(
  File "/root/miniconda3/envs/ragflow/lib/python3.12/site-packages/urllib3/connection.py", line 441, in request
    self.endheaders()
  File "/root/miniconda3/envs/ragflow/lib/python3.12/http/client.py", line 1331, in endheaders
    self.info = self.es.info()
                ^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/ragflow/lib/python3.12/site-packages/elasticsearch/_sync/client/utils.py", line 446, in wrapped
    return api(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/ragflow/lib/python3.12/site-packages/elasticsearch/_sync/client/__init__.py", line 2464, in info
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/root/miniconda3/envs/ragflow/lib/python3.12/http/client.py", line 1091, in _send_output
    self.send(msg)
  File "/root/miniconda3/envs/ragflow/lib/python3.12/http/client.py", line 1035, in send
    return self.perform_request(  # type: ignore[return-value]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/ragflow/lib/python3.12/site-packages/elasticsearch/_sync/client/_base.py", line 271, in perform_request
    self.connect()
  File "/root/miniconda3/envs/ragflow/lib/python3.12/site-packages/urllib3/connection.py", line 279, in connect
    response = self._perform_request(
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/ragflow/lib/python3.12/site-packages/elasticsearch/_sync/client/_base.py", line 316, in _perform_request
    self.sock = self._new_conn()
                ^^^^^^^^^^^^^^^^
    meta, resp_body = self.transport.perform_request(
  File "/root/miniconda3/envs/ragflow/lib/python3.12/site-packages/urllib3/connection.py", line 199, in _new_conn
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/ragflow/lib/python3.12/site-packages/elastic_transport/_transport.py", line 342, in perform_request
    sock = connection.create_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    resp = node.perform_request(
  File "/root/miniconda3/envs/ragflow/lib/python3.12/site-packages/urllib3/util/connection.py", line 73, in create_connection
           ^^^^^^^^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/ragflow/lib/python3.12/site-packages/elastic_transport/_node/_http_urllib3.py", line 167, in perform_request
    response = self.pool.urlopen(
               ^^^^^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/ragflow/lib/python3.12/site-packages/urllib3/connectionpool.py", line 789, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/ragflow/lib/python3.12/site-packages/urllib3/connectionpool.py", line 495, in _make_request
    sock.connect(sa)


### Additional information

_No response_
KevinHuSh commented 2 weeks ago

Make sure ES is accessible in docker container by the configuration of conf/service_conf.yaml