Skip to main content

Database in Serving Clusters

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.

📘Notes

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

📘Notes

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 use the Zilliz Cloud RESTful API or SDKs to create a database 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 for the database when you create it. The following example sets the number of replicas of the database.

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

View databases​

You can use the Zilliz Cloud RESTful API or SDKs to list all existing databases and view their details.

python
# List all existing databases
client.list_databases()

# Output
# ['default', 'my_database_1', 'my_database_2']

# Check database details
client.describe_database(
db_name="default"
)

# Output
# {"name": "default"}

Manage database properties​

Each database has its own properties, you can set the properties of a database when you create the database as described in Create database or you can alter and drop the properties of any existing database.

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​

You can alter the properties of an existing database as follows. The following example limits the number of collections you can create in the database.

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

Drop database properties​

You can also reset a database property by dropping it as follows. The following example removes the limit on the number of collections you can create in the 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 disconnecting from Zilliz Cloud.

📘Notes

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​

Once a database is no longer needed, you can drop the database. Note that:

  • Default databases cannot be dropped.

  • Before dropping a database, you need to drop all collections in the database first.

You can use the Zilliz Cloud RESTful API or SDKs to drop a database programmatically.

python
client.drop_database(
db_name="my_database_2"
)

FAQ​

How do I manage permissions for a database?​

Zilliz Cloud uses Role-Based Access Control (RBAC) to manage permissions. You can create roles with specific privileges and assign them to users, thus controlling their access to different databases. For more details, refer to the RBAC documentation.

Are there any quota limitations for a database?​

Yes, Zilliz Cloud allows you to set quota limitations for a database, such as the maximum number of collections. For a comprehensive list of limitations, please refer to the Zilliz Cloud Limits documentation.

Next steps​