langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
51.81k stars 7.51k forks source link

Failed to connect to Milvus #8725

Closed taowang1993 closed 1 month ago

taowang1993 commented 1 month ago

Self Checks

Dify version

0.8.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

image

VECTOR_STORE=milvus MILVUS_URI=http://127.0.0.1:19530 MILVUS_TOKEN= MILVUS_USER=root MILVUS_PASSWORD=Milvus

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

taowang1993 commented 1 month ago
image
taowang1993 commented 1 month ago

the milvus-standalone is running, but not connecting

dosubot[bot] commented 1 month ago

I found similar issues and discussions that might help you resolve the connection problem with Milvus:

  1. Connection error: request error, status_code: 503 [1]
  2. Vector database connection error [2]
  3. Milvus local URI does not work (closed) [3]

The suggested solution for the MILVUS_URI setting is to use the service name defined in the Docker Compose file instead of 127.0.0.1 or localhost. Docker's internal DNS can resolve the correct container. For example, if the Milvus service is defined as milvus-standalone, you should set MILVUS_URI to http://milvus-standalone:19530.

Update your .env file as follows:

MILVUS_URI=http://milvus-standalone:19530

This should allow Docker to correctly route the request to the Milvus container.

Additionally, ensure that the Milvus standalone instance is correctly set up and running. Here are a few things to check:

  1. Environment Variables: Ensure ETCD_ENDPOINTS and MINIO_ADDRESS are correctly set and the services they point to are running.
  2. Ports: Verify that ports 19530 and 9091 are correctly mapped and not used by other services.
  3. Health Check: Check the health status of the Milvus container using the health check endpoint http://localhost:9091/healthz.
  4. Dependencies: Ensure etcd and minio services are up and running since Milvus depends on them.
  5. Configuration Parameters: Ensure all required configuration parameters are provided, such as uri, user, and password.

For more details, you can refer to the Dify documentation and the .env.example file in the repository [4][5][6][7].

To continue talking to Dosu, mention @dosu.

crazywoola commented 1 month ago

See https://github.com/langgenius/dify/pull/8019

taowang1993 commented 1 month ago

See #8019

I added networks to the worker and api containers. Now it is working. And I specified the URI as MILVUS_URI=http://milvus-standalone:19530

docker-compose.override.yaml (I think it is good to have this file because the default docker-compose.yaml file will be overriden when updating Dify)

name: dify

services: api: image: langgenius/dify-api:latest networks: