Skip to main content

Database in Serving Clusters

This feature is available only with the Enterprise plan or higher.

A database in a serving cluster is a logical container for collections hosted by a Dedicated serving cluster. Use this page to create, view, configure, use, and drop databases through a serving cluster endpoint.

📘Note

This page is for databases in serving clusters. For project-level databases queried with on-demand compute, see Database for On-Demand Search. For a comparison of database models, see Database Explained.

Before you begin

Ensure that:

  • You have created a Dedicated serving cluster.

  • You have the serving cluster endpoint, for example https://{cluster-id}.{region}.vectordb.zillizcloud.com:19530.

  • You have an authentication token. This can be an API key with access to the target cluster or a cluster credential in username:password format.

  • You have Organization Owner or Project Admin access to manage databases.

When a Dedicated cluster is created, a default database is created automatically. You can create up to 1,024 databases in a Dedicated cluster.

Create database

You can create a database from the Zilliz Cloud console or programmatically.

python
from pymilvus import MilvusClient

client = MilvusClient(
uri="YOUR_CLUSTER_ENDPOINT",
token="YOUR_CLUSTER_TOKEN",
)

client.create_database(
db_name="my_database_1",
)

You can also set properties when creating a database. The following example sets the number of replicas.

python
client.create_database(
db_name="my_database_2",
properties={
"database.replica.number": 3,
},
)

View databases

List databases or describe a specific database.

python
databases = client.list_databases()
print(databases)

database = client.describe_database(
db_name="default",
)
print(database)

Manage database properties

The following database properties can be configured for databases in serving clusters.

PropertyDescription
database.replica.numberThe number of replicas for the database.
database.max.collectionsThe maximum number of collections allowed in the database.
database.force.deny.writingWhether to deny write operations for the database.
database.force.deny.readingWhether to deny read operations for the database.

Alter database properties

The following example limits the number of collections that can be created in a database.

python
client.alter_database_properties(
db_name="my_database_1",
properties={
"database.max.collections": 10,
},
)

Drop database properties

The following example removes the collection limit from a database.

python
client.drop_database_properties(
db_name="my_database_1",
property_keys=[
"database.max.collections",
],
)

Use database

You can switch from one database to another without reconnecting when using an SDK.

📘Note

RESTful API does not support switching databases on a persistent connection. For RESTful API requests, specify the target database in each request body when the operation supports dbName.

python
client.use_database(
db_name="my_database_2",
)

Drop database

Default databases cannot be dropped. Before dropping a database, drop all collections in the database first.

python
client.drop_database(
db_name="my_database_2",
)

Next steps

Ctrl I