Skip to main content
Version: User Guides (BYOC)

Database

Zilliz Cloud introduces a database layer in between the clusters and collections, providing a more efficient way to manage and organize your data while supporting multi-tenancy.

What is a database

In Zilliz Cloud, a database serves as a logical unit for organizing and managing data. To enhance data security and achieve multi-tenancy, you can create multiple databases to logically isolate data for different applications or tenants. For example, you create a database to store the data of user A and another database for user B.

The resources are structured in the following hierarchical order in Zilliz Cloud.

KkS9wtS5IhcP9obYvc1cK10snfg

It can be noted that the concept of database is only available to Dedicated clusters. Serverless and Free clusters do not have databases.

Prerequisites

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

Create database

Databases can only be created in Dedicated clusters. Upon the creation of a cluster, a default database will be created.

You can create up to 1,024 databases in a Dedicated cluster either manually on the console or programmatically.

Create a database on the console

You can create a database on the console as shown in the following figure.

create-database

You can also move created collections from one database to another. For more details, refer to Manage Collections (Console).

Create a database programmatically

You can use the Milvus RESTful API or SDKs to create data programmatically.

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.

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

View databases

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

# 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 a database programmatically or you can alter and drop the properties of any existing database.

The following table lists possible database properties.

Property Name

Type

Property Description

database.replica.number

integer

The number of replicas for the specified database.

database.max.collections

integer

The maximum number of collections allowed in the specified database.

database.force.deny.writing

boolean

Whether to force the specified database to deny writing operations.

database.force.deny.reading

boolean

Whether to force the specified database to deny reading operations.

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.

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.

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

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.

Drop a database on the console

You can drop the database on the console by following the procedure in the figure below.

drop-database

Drop a database programmatically

You can use the Milvus RESTful API or SDKs to create data programmatically.

client.drop_database(
db_name="my_database_2"
)