Unable to connect to Milvus managed cluster via MilvusClient Python API

210 views Asked by At

I have a very simple python code that attempts to connect to a managed Milvus cluster on GCP:

client = MilvusClient(
    uri=MY_URI,
    token=MY_API_KEY)

Though I keep getting this exception:

pymilvus.exceptions.MilvusException: <MilvusException: (code=2, message=Fail connecting to server on MY_URI:443. Timeout)>

I am however able to ping this instance from the terminal and see it as running on the Milvus dashboard. Any ideas or hints on what might be going on?

Thanks!

1

There are 1 answers

0
Christy On

Are you using free serverless Zilliz cloud? It uses GCP by default. See this bootcamp for a RAG example using Zilliz. https://github.com/milvus-io/bootcamp/blob/master/bootcamp/RAG/readthedocs_zilliz_langchain.ipynb > Cell#4

import os, pymilvus 
from pymilvus import connections

# Connect to Zilliz cloud using endpoint URI and API key TOKEN.
TOKEN = os.getenv("ZILLIZ_API_KEY")
CLUSTER_ENDPOINT="https://in03-xxxx.api.gcp-us-west1.zillizcloud.com:443"
connections.connect(
  alias='default',
  uri=CLUSTER_ENDPOINT,
  token=TOKEN,
)