milvus-logo

Connect to the Server

This article describes how to connect to a Milvus server from a Python client.

  • See Python API documentation for details about APIs.
  • We recommend using Milvus Sizing Tool to estimate the hardware resources required for the data.
    1. Import pymilvus:

      # Import pymilvus.
      >>> from milvus import Milvus, IndexType, MetricType, Status
      
    2. Use any of the following methods to connect to the Milvus server:

      # Connect to the Milvus server.
      >>> milvus = Milvus(host='localhost', port='19530')
      
      In the above code, host and port both use default values. You can change them to your IP address and port.
      >>> milvus = Milvus(uri='tcp://localhost:19530')
      

    FAQ

    Does Milvus' Python SDK have a connection pool? Python SDKs corresponding to Milvus v0.9.0 or later have a connection pool. There is no upper limit on the default number of connections in a connection pool.
    How to fix the error when I install pymilvus on Windows? Try installing pymilvus in a Conda environment.
    On this page