Failed to connect to Milvus #5778

Closed
opened 2026-02-21 18:12:33 -05:00 by yindo · 7 comments
Owner

Originally created by @taowang1993 on GitHub (Sep 24, 2024).

Self Checks

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

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

Originally created by @taowang1993 on GitHub (Sep 24, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.8.3 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce <img width="835" alt="image" src="https://github.com/user-attachments/assets/8f0a972c-96bd-4572-b830-4e953e8a3c29"> 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_
yindo added the 👻 feat:rag label 2026-02-21 18:12:33 -05:00
yindo closed this issue 2026-02-21 18:12:33 -05:00
Author
Owner

@taowang1993 commented on GitHub (Sep 24, 2024):

image
@taowang1993 commented on GitHub (Sep 24, 2024): <img width="1034" alt="image" src="https://github.com/user-attachments/assets/600403de-6fef-491b-aa31-610084bc91db">
Author
Owner

@taowang1993 commented on GitHub (Sep 24, 2024):

the milvus-standalone is running, but not connecting

@taowang1993 commented on GitHub (Sep 24, 2024): the milvus-standalone is running, but not connecting
Author
Owner

@dosubot[bot] commented on GitHub (Sep 24, 2024):

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.

@dosubot[bot] commented on GitHub (Sep 24, 2024): <!-- Answer --> I found similar issues and discussions that might help you resolve the connection problem with Milvus: 1. [Connection error: request error, status_code: 503](https://github.com/langgenius/dify/discussions/6181) <sup>[[1]](https://github.com/langgenius/dify/discussions/6181)</sup> 2. [Vector database connection error](https://github.com/langgenius/dify/discussions/7142) <sup>[[2]](https://github.com/langgenius/dify/discussions/7142)</sup> 3. [Milvus local URI does not work](https://github.com/langgenius/dify/issues/8562) (closed) <sup>[[3]](https://github.com/langgenius/dify/issues/8562)</sup> 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: ```shell 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 <sup>[[4]](https://github.com/langgenius/dify/blob/main/docker/docker-compose.yaml)</sup><sup>[[5]](https://github.com/langgenius/dify/blob/main/api/tests/unit_tests/core/rag/datasource/vdb/milvus/test_milvus.py)</sup><sup>[[6]](https://github.com/langgenius/dify/blob/main/docker-legacy/docker-compose.milvus.yaml)</sup><sup>[[7]](https://github.com/langgenius/dify/blob/main/docker/.env.example)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@crazywoola commented on GitHub (Sep 24, 2024):

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

@crazywoola commented on GitHub (Sep 24, 2024): See https://github.com/langgenius/dify/pull/8019
Author
Owner

@taowang1993 commented on GitHub (Sep 24, 2024):

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:
- ssrf_proxy_network
- default
- milvus

worker:
image: langgenius/dify-api:latest
networks:
- ssrf_proxy_network
- default
- milvus

web:
image: langgenius/dify-web:latest

@taowang1993 commented on GitHub (Sep 24, 2024): > 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: - ssrf_proxy_network - default - milvus worker: image: langgenius/dify-api:latest networks: - ssrf_proxy_network - default - milvus web: image: langgenius/dify-web:latest
Author
Owner

@applepieiris commented on GitHub (Nov 18, 2024):

MILVUS_URI

so should I also change the MILVUS_URI: http://127.0.0.1:19530 defined in docker-compose.yaml to MILVUS_URI=http://milvus-standalone:19530/ ?
localhost -> milvus-standalone?

@applepieiris commented on GitHub (Nov 18, 2024): > MILVUS_URI so should I also change the `MILVUS_URI: http://127.0.0.1:19530` defined in docker-compose.yaml to `MILVUS_URI=http://milvus-standalone:19530/` ? localhost -> milvus-standalone?
Author
Owner

@KyrieWang7 commented on GitHub (Nov 29, 2024):

nginx-1 | 183.90.191.61 - - [29/Nov/2024:12:36:38 +0000] "GET /console/api/workspaces/current/models/model-types/text-embedding HTTP/1.1" 200 13 "http://xxxxxx:8090/datasets/create" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36" "-"
worker-1 | 2024-11-29 12:36:40.098 INFO [MainThread] [strategy.py:161] - Task tasks.document_indexing_task.document_indexing_task[dc6873e7-1ddd-44a0-a7ad-67bd52376bb5] received
worker-1 | 2024-11-29 12:36:40.098 DEBUG [MainThread] [base.py:149] - TaskPool: Apply <function fast_trace_task at 0x7f38f3a8a8e0> (args:('tasks.document_indexing_task.document_indexing_task', 'dc6873e7-1ddd-44a0-a7ad-67bd52376bb5', {'lang': 'py', 'task': 'tasks.document_indexing_task.document_indexing_task', 'id': 'dc6873e7-1ddd-44a0-a7ad-67bd52376bb5', 'shadow': None, 'eta': None, 'expires': None, 'group': None, 'group_index': None, 'retries': 0, 'timelimit': [None, None], 'root_id': 'dc6873e7-1ddd-44a0-a7ad-67bd52376bb5', 'parent_id': None, 'argsrepr': "('85e9d18e-c95c-403f-bb3e-be573f35ac63', ['1d0cd930-a3b6-49cc-9a79-deaf4ac4b13a'])", 'kwargsrepr': '{}', 'origin': 'gen62@304be3797814', 'ignore_result': True, 'replaced_task_nesting': 0, 'stamped_headers': None, 'stamps': {}, 'properties': {'correlation_id': 'dc6873e7-1ddd-44a0-a7ad-67bd52376bb5', 'reply_to': '82838031-1f18-39d3-8605-975e17322089', 'delivery_mode': 2, 'delivery_info': {'exchange': '', 'routing_key': 'dataset'}, 'priority': 0, 'body_encoding': 'base64', 'delivery_tag': 'b4967e74-3c9d-4ae6-9b1a-7954693d6f2c'}, 'reply_to': '82838031-1f18-39d3-8605-975e17322089',... kwargs:{})
worker-1 | 2024-11-29 12:36:40.102 INFO [Dummy-10] [document_indexing_task.py:59] - Start process document: 1d0cd930-a3b6-49cc-9a79-deaf4ac4b13a
nginx-1 | 183.90.191.61 - - [29/Nov/2024:12:36:40 +0000] "POST /console/api/datasets/init HTTP/1.1" 200 1272 "http://xxxxxx:8090/datasets/create" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36" "-"
nginx-1 | 183.90.191.61 - - [29/Nov/2024:12:36:40 +0000] "GET /console/api/datasets/85e9d18e-c95c-403f-bb3e-be573f35ac63/batch/20241129123640865508/indexing-status HTTP/1.1" 200 349 "http://xxxxxx:8090/datasets/create" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36" "-"
nginx-1 | 183.90.191.61 - - [29/Nov/2024:12:36:40 +0000] "GET /console/api/datasets/process-rule?document_id=1d0cd930-a3b6-49cc-9a79-deaf4ac4b13a HTTP/1.1" 200 232 "http://xxxxxx:8090/datasets/create" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36" "-"
worker-1 | Building prefix dict from the default dictionary ...
worker-1 | 2024-11-29 12:36:41.238 DEBUG [Thread-11 (_process_keyword_index)] [__init__.py:113] - Building prefix dict from the default dictionary ...
worker-1 | Dumping model to file cache /tmp/jieba.cache
worker-1 | 2024-11-29 12:36:41.747 DEBUG [Thread-11 (_process_keyword_index)] [__init__.py:146] - Dumping model to file cache /tmp/jieba.cache
worker-1 | Loading model cost 0.567 seconds.
worker-1 | Prefix dict has been built successfully.
worker-1 | 2024-11-29 12:36:41.805 DEBUG [Thread-11 (_process_keyword_index)] [__init__.py:164] - Loading model cost 0.567 seconds.
worker-1 | 2024-11-29 12:36:41.805 DEBUG [Thread-11 (_process_keyword_index)] [__init__.py:166] - Prefix dict has been built successfully.
worker-1 | 2024-11-29 12:36:41.973 INFO [Dummy-10] [document_indexing_task.py:76] - Processed dataset: 85e9d18e-c95c-403f-bb3e-be573f35ac63 latency: 1.8738773688673973
worker-1 | 2024-11-29 12:36:41.992 INFO [Dummy-10] [trace.py:128] - Task tasks.document_indexing_task.document_indexing_task[dc6873e7-1ddd-44a0-a7ad-67bd52376bb5] succeeded in 1.8937109746038914s: None
sandbox-1 | [GIN] 2024/11/29 - 12:36:42 | 200 | 23.263µs | ::1 | GET "/health"
nginx-1 | 183.90.191.61 - - [29/Nov/2024:12:36:42 +0000] "GET /console/api/datasets/85e9d18e-c95c-403f-bb3e-be573f35ac63/batch/20241129123640865508/indexing-status HTTP/1.1" 200 369 "http://xxxxxx:8090/datasets/create" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36" "-"
sandbox-1 | [GIN] 2024/11/29 - 12:37:12 | 200 | 36.206µs | ::1 | GET "/health"

I have configured the vector storage as Milvus, using Alibaba Cloud’s Milvus. Why is the data not written into Milvus when I create a knowledge base?

@KyrieWang7 commented on GitHub (Nov 29, 2024): nginx-1 | 183.90.191.61 - - [29/Nov/2024:12:36:38 +0000] "GET /console/api/workspaces/current/models/model-types/text-embedding HTTP/1.1" 200 13 "http://xxxxxx:8090/datasets/create" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36" "-" worker-1 | 2024-11-29 12:36:40.098 INFO [MainThread] [strategy.py:161] - Task tasks.document_indexing_task.document_indexing_task[dc6873e7-1ddd-44a0-a7ad-67bd52376bb5] received worker-1 | 2024-11-29 12:36:40.098 DEBUG [MainThread] [base.py:149] - TaskPool: Apply <function fast_trace_task at 0x7f38f3a8a8e0> (args:('tasks.document_indexing_task.document_indexing_task', 'dc6873e7-1ddd-44a0-a7ad-67bd52376bb5', {'lang': 'py', 'task': 'tasks.document_indexing_task.document_indexing_task', 'id': 'dc6873e7-1ddd-44a0-a7ad-67bd52376bb5', 'shadow': None, 'eta': None, 'expires': None, 'group': None, 'group_index': None, 'retries': 0, 'timelimit': [None, None], 'root_id': 'dc6873e7-1ddd-44a0-a7ad-67bd52376bb5', 'parent_id': None, 'argsrepr': "('85e9d18e-c95c-403f-bb3e-be573f35ac63', ['1d0cd930-a3b6-49cc-9a79-deaf4ac4b13a'])", 'kwargsrepr': '{}', 'origin': 'gen62@304be3797814', 'ignore_result': True, 'replaced_task_nesting': 0, 'stamped_headers': None, 'stamps': {}, 'properties': {'correlation_id': 'dc6873e7-1ddd-44a0-a7ad-67bd52376bb5', 'reply_to': '82838031-1f18-39d3-8605-975e17322089', 'delivery_mode': 2, 'delivery_info': {'exchange': '', 'routing_key': 'dataset'}, 'priority': 0, 'body_encoding': 'base64', 'delivery_tag': 'b4967e74-3c9d-4ae6-9b1a-7954693d6f2c'}, 'reply_to': '82838031-1f18-39d3-8605-975e17322089',... kwargs:{}) worker-1 | 2024-11-29 12:36:40.102 INFO [Dummy-10] [document_indexing_task.py:59] - Start process document: 1d0cd930-a3b6-49cc-9a79-deaf4ac4b13a nginx-1 | 183.90.191.61 - - [29/Nov/2024:12:36:40 +0000] "POST /console/api/datasets/init HTTP/1.1" 200 1272 "http://xxxxxx:8090/datasets/create" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36" "-" nginx-1 | 183.90.191.61 - - [29/Nov/2024:12:36:40 +0000] "GET /console/api/datasets/85e9d18e-c95c-403f-bb3e-be573f35ac63/batch/20241129123640865508/indexing-status HTTP/1.1" 200 349 "http://xxxxxx:8090/datasets/create" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36" "-" nginx-1 | 183.90.191.61 - - [29/Nov/2024:12:36:40 +0000] "GET /console/api/datasets/process-rule?document_id=1d0cd930-a3b6-49cc-9a79-deaf4ac4b13a HTTP/1.1" 200 232 "http://xxxxxx:8090/datasets/create" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36" "-" worker-1 | Building prefix dict from the default dictionary ... worker-1 | 2024-11-29 12:36:41.238 DEBUG [Thread-11 (_process_keyword_index)] [__init__.py:113] - Building prefix dict from the default dictionary ... worker-1 | Dumping model to file cache /tmp/jieba.cache worker-1 | 2024-11-29 12:36:41.747 DEBUG [Thread-11 (_process_keyword_index)] [__init__.py:146] - Dumping model to file cache /tmp/jieba.cache worker-1 | Loading model cost 0.567 seconds. worker-1 | Prefix dict has been built successfully. worker-1 | 2024-11-29 12:36:41.805 DEBUG [Thread-11 (_process_keyword_index)] [__init__.py:164] - Loading model cost 0.567 seconds. worker-1 | 2024-11-29 12:36:41.805 DEBUG [Thread-11 (_process_keyword_index)] [__init__.py:166] - Prefix dict has been built successfully. worker-1 | 2024-11-29 12:36:41.973 INFO [Dummy-10] [document_indexing_task.py:76] - Processed dataset: 85e9d18e-c95c-403f-bb3e-be573f35ac63 latency: 1.8738773688673973 worker-1 | 2024-11-29 12:36:41.992 INFO [Dummy-10] [trace.py:128] - Task tasks.document_indexing_task.document_indexing_task[dc6873e7-1ddd-44a0-a7ad-67bd52376bb5] succeeded in 1.8937109746038914s: None sandbox-1 | [GIN] 2024/11/29 - 12:36:42 | 200 | 23.263µs | ::1 | GET "/health" nginx-1 | 183.90.191.61 - - [29/Nov/2024:12:36:42 +0000] "GET /console/api/datasets/85e9d18e-c95c-403f-bb3e-be573f35ac63/batch/20241129123640865508/indexing-status HTTP/1.1" 200 369 "http://xxxxxx:8090/datasets/create" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36" "-" sandbox-1 | [GIN] 2024/11/29 - 12:37:12 | 200 | 36.206µs | ::1 | GET "/health" I have configured the vector storage as Milvus, using Alibaba Cloud’s Milvus. Why is the data not written into Milvus when I create a knowledge base?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#5778