dify icon indicating copy to clipboard operation
dify copied to clipboard

Vector daabase connection error

Open Lyeluo opened this issue 2 years ago • 2 comments

Self Checks

  • [X] This is only for bug report, if you would like to ask a question, please head to Discussions.
  • [X] I have searched for existing issues search for existing issues, including closed ones.
  • [X] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • [X] Please do not modify this template :) and fill in all the required fields.

Dify version

0.10.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

when i update dify version to 0.10.2, my knowledge can't vector document .I followed the official documentation for the upgrade.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/api/core/rag/datasource/vdb/weaviate/weaviate_vector.py", line 45, in _init_client
    client = weaviate.Client(
  File "/app/api/.venv/lib/python3.10/site-packages/weaviate/client.py", line 150, in __init__
    self._connection = Connection(
  File "/app/api/.venv/lib/python3.10/site-packages/weaviate/connect/connection.py", line 654, in __init__
    self._server_version = self.get_meta()["version"]
  File "/app/api/.venv/lib/python3.10/site-packages/weaviate/connect/connection.py", line 675, in get_meta
    response = self.get(path="/meta")
  File "/app/api/.venv/lib/python3.10/site-packages/weaviate/connect/connection.py", line 516, in get
    return self._session.get(
  File "/app/api/.venv/lib/python3.10/site-packages/requests/sessions.py", line 602, in get
    return self.request("GET", url, **kwargs)
  File "/app/api/.venv/lib/python3.10/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "/app/api/.venv/lib/python3.10/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "/app/api/.venv/lib/python3.10/site-packages/requests/adapters.py", line 519, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='weaviate', port=8080): Max retries exceeded with url: /v1/meta (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7fef8dadc580>: Failed to resolve 'weaviate' ([Errno -2] Name or service not known)"))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/api/core/indexing_runner.py", line 75, in run
    self._load(
  File "/app/api/core/indexing_runner.py", line 677, in _load
    tokens += future.result()
  File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 458, in result
    return self.__get_result()
  File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/app/api/core/indexing_runner.py", line 734, in _process_chunk
    index_processor.load(dataset, chunk_documents, with_keywords=False)
  File "/app/api/core/rag/index_processor/processor/paragraph_index_processor.py", line 59, in load
    vector = Vector(dataset)
  File "/app/api/core/rag/datasource/vdb/vector_factory.py", line 35, in __init__
    self._vector_processor = self._init_vector()
  File "/app/api/core/rag/datasource/vdb/vector_factory.py", line 56, in _init_vector
    return vector_factory_cls().init_vector(self._dataset, self._attributes, self._embeddings)
  File "/app/api/core/rag/datasource/vdb/weaviate/weaviate_vector.py", line 275, in init_vector
    return WeaviateVector(
  File "/app/api/core/rag/datasource/vdb/weaviate/weaviate_vector.py", line 36, in __init__
    self._client = self._init_client(config)
  File "/app/api/core/rag/datasource/vdb/weaviate/weaviate_vector.py", line 49, in _init_client
    raise ConnectionError("Vector database connection error")
ConnectionError: Vector database connection error
[2024-11-07 02:10:35,666: INFO/MainProcess] Processed dataset: b2ed024f-745e-4f82-aab7-a46fbeadf9d1 latency: 0.6662511900067329
[2024-11-07 02:10:35,699: INFO/MainProcess] Task tasks.document_indexing_task.document_indexing_task[db8f4d87-0c7e-4e9b-9c4b-cf56a76d5dde] succeeded in 0.698721113614738s: None

✔️ Expected Behavior

Upgrade to version 0.10.2, retain the vector data in the existing knowledge base, and support uploading and vectorizing new documents.

❌ Actual Behavior

Vector daabase connection error

Lyeluo avatar Nov 07 '24 02:11 Lyeluo

Check the status of the vdb, if you do not see it I think you can run docker compose up -d --profile=weaviate

crazywoola avatar Nov 07 '24 02:11 crazywoola

I found a similar issue that was closed, which might help you resolve the vector database connection error you're experiencing:

  1. v0.9.2 can't connect to vector database: The suggested solution is to ensure that your configuration settings for the vector database are correct. Depending on the vector database you are using (e.g., Weaviate), you need to set specific environment variables such as VECTOR_STORE, WEAVIATE_ENDPOINT, etc. You can find detailed configuration examples in the .env.example file in the Dify repository. Additionally, make sure your Docker network settings are correctly configured to allow communication between Dify and the vector database, which might involve setting up appropriate network bridges or ensuring that the correct ports are exposed [1].

  2. ConnectionError: Vector database connection error: The suggested solution is to check your network connection to ensure the Docker container or application can access the vector database [2].

For your specific issue, ensure that the WEAVIATE_ENDPOINT is correctly set in your environment variables and that the Weaviate service is accessible from your Dify setup. Also, verify that both services are on the same Docker network to facilitate communication [3].

To continue talking to Dosu, mention @dosu.

dosubot[bot] avatar Nov 07 '24 02:11 dosubot[bot]