Skip to content

[Bug]: Cannot create connections to different milvus instances #2715

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
jperez999 opened this issue Mar 31, 2025 · 2 comments
Open
1 task done

[Bug]: Cannot create connections to different milvus instances #2715

jperez999 opened this issue Mar 31, 2025 · 2 comments
Labels
kind/question A question to answer

Comments

@jperez999
Copy link

jperez999 commented Mar 31, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When I try to create two connections to separate instances of milvus, in the same execution, I get errors.

Expected Behavior

I expect to be able to make both connections successfully.

Steps/Code To Reproduce behavior

When I execute the following code:

import uuid
from pymilvus import (
    MilvusClient,
    connections
)

a_name = str(uuid.uuid4())[:8]
collection_name = "test_collection"
milvus_uri = "http://milvus:19530"
connections.connect(alias=a_name, uri=milvus_uri)
client_1 = MilvusClient(milvus_uri, alias=a_name)

a_name = str(uuid.uuid4())[:8]
collection_name = "test_collection"
milvus_uri = "http://10.57.202.36:19530"
connections.connect(alias=a_name, uri=milvus_uri)
client_2 = MilvusClient(milvus_uri, alias=a_name)

I get this error:

Traceback (most recent call last):
  File "/opt/conda/envs/nv_ingest_runtime/lib/python3.10/pdb.py", line 1723, in main
    pdb._runscript(mainpyfile)
  File "/opt/conda/envs/nv_ingest_runtime/lib/python3.10/pdb.py", line 1583, in _runscript
    self.run(statement)
  File "/opt/conda/envs/nv_ingest_runtime/lib/python3.10/bdb.py", line 598, in run
    exec(cmd, globals, locals)
  File "<string>", line 1, in <module>
  File "/raid/workspace/nv-ingest/client/client_examples/examples/index_test.py", line 12, in <module>
    client_1 = MilvusClient(milvus_uri, alias=a_name)
  File "/opt/conda/envs/nv_ingest_runtime/lib/python3.10/site-packages/pymilvus/milvus_client/milvus_client.py", line 66, in __init__
    self._using = self._create_connection(
  File "/opt/conda/envs/nv_ingest_runtime/lib/python3.10/site-packages/pymilvus/milvus_client/milvus_client.py", line 921, in _create_connection
    raise ex from ex
  File "/opt/conda/envs/nv_ingest_runtime/lib/python3.10/site-packages/pymilvus/milvus_client/milvus_client.py", line 918, in _create_connection
    connections.connect(using, user, password, db_name, token, uri=uri, **kwargs)
TypeError: Connections.connect() got multiple values for argument 'alias'

Environment details

- Hardware/Softward conditions (OS, CPU, GPU, Memory):
- Method of installation (Docker, or from source):
- Milvus version (v0.3.1, or v0.4.0):
- Milvus configuration (Settings you made in `server_config.yaml`):

Anything else?

No response

@XuanYang-cn
Copy link
Contributor

It's not recommanded to use connections together with MilvusClient. c = MilvusClient(uti="http:/localhost:19530") will connect with the server too.

@XuanYang-cn XuanYang-cn added kind/question A question to answer and removed kind/bug Something isn't working labels Apr 14, 2025
@jperez999
Copy link
Author

jperez999 commented Apr 17, 2025

It's not recommanded to use connections together with MilvusClient. c = MilvusClient(uti="http:/localhost:19530") will connect with the server too.

Can you give more detail into why this is the case. The ip addresses shown there, are just examples, but what we mean is that we want to be able to handle connections to multiple different instances of milvus. That can be on separate machines (i.e. different connection URIs)

Also I was able to fix this, by fixing the alias functionality, submitted a PR for this #2716

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/question A question to answer
Projects
None yet
Development

No branches or pull requests

2 participants