
Milvus is an open-source, distributed database designed to efficiently manage vector data. Its actual real-world use cases include integration with applications such as recommendation systems, Natural Language Processing (NLP), image and video retrieval. By leveraging vector data, Milvus DB is a crucial component for systems that rely on similarity-based search and retrieval of high-dimensional data points.
To scale a Milvus database system on your Vultr Kubernetes Engine (VKE) cluster, install a Milvus operator that enables the deployment and management of the Milvus cluster.
This article explains how to install Milvus DB on a Vultr Kubernetes Engine (VKE) cluster. You are to deploy a Milvus operator and install a Milvus cluster. Then, you will apply custom resource definitions to set up external access to the database service and test the external service by creating a new database.
Before you start:
5 nodesYou can install a Milvus Operator to a VKE cluster in two ways. You can either use a helm chart or Kubectl. In this section, deploy a Milvus Operator to your cluster using Kubectl. Then, change the PVC storage class and install Cert-Manager to handle the process of renewing and obtaining cluster SSL certificates as described in the steps below.
Milvus DB requires Vultr high performance PVCs to work well. Disable the default cluster Vultr Block Storage HDD annotation class
Enable the Vultr Block Storage high-performance class
When successful, your output should look like the one below:
Install the latest Cert-Manager version
The above command installs version 1.5.3, visit the Cert-Manager releases page to verify the latest version
Output:
View the Cert-Manager pods to verify that the installation is successful
Output:
Install the Milvus operator
Output:
Verify that the Milvus operator is ready and running in your cluster
Output:
Milvus Custom Resource Definitions (CRDs) allow you to create custom resources and schemas. When installed, CRDs can be managed using operators. In this section, install the Milvus cluster by defining Milvus CRDs, apply the cluster configuration, and verify that the cluster pods are running as described below.
Using a text editor such as nano, edit the milvus_cluster.yaml file
Add the following configurations to the file
Save and close the file.
In the above configuration, no dependencies are defined as Milvus relies on default dependencies such as etcd, minio, and pulsar. Below is what each dependency does:
etcd: Supports Milvus's metadata storage and accessminio: MinIO and S3 are supported as storage engines for data persistencepulsar: Supports the Milvus cluster's reliable storage and the publication/subscription of message streamsBelow is the function of each defined Milvus component:
mixCoord: Includes coordinators such as query coordinator, index coordinator, root coordinator, and data coordinator. These are responsible for load-balancing, maintaining index metadata, and maintaining background data operationsdataNode: Retrieves incremental log data, converts it to log snapshots, and stores it to a Milvus block storage volumeindexNode: Builds Vector indexesqueryNode: Performs a hybrid search of vector and scalar dataauthorizationEnabled: When set to true, it allows you to apply and control user access to the database to increase security and reliabilityApply the Milvus cluster configuration
Output:
Wait for at least 10 minutes and verify the Mivus cluster status
When successful, your output should look like the one below:
As displayed in the above output, status: Healthy shows that the deployment is successfully created and running. Also, the number of replicas for each component should match your Milvus CRD configuration.
Verify the Milvus cluster pods status
Output:
As displayed in the above output, all required pods are running and execution jobs are complete. By default Milvus creates pods the dependencies before all components.
When all Pods are running, the Milvus Cluster creates the necessary Vultr high performance storage volumes in your account. Verify the PVC status to verify the available block storage volumes
Access the Vultr Console and verify that the listed object storage volumes in your output are available in your account.
In this section, set up an external access service using the Vultr Cloud Control Manager (CCM) and LoadBalancer service to expose the database using the Milvus default port 19530 as described below.
Create a new file external_access.yaml
Add the following configurations to the file
Save and close the file.
The above configuration exposes the Milvus service through the default TCP port 19530. The targetPort is set to milvus to encounter any MilvusDB default port changes.
Apply the external deployment to your cluster
Output:
Wait for at least 6 minutes to deploy the Load balancer resource. Then, view the cluster service
Verify the External-IP value in your output like the one below:
In the above output, 192.0.2.100 is the load balancer external IP Address you can use to access the Milvus DB.
Using Pip, install the pymilvus module on your server
The above command installs pymilvus: An open-source Python SDK designed to interact with MilvusDB.
Create a new Python application file
Add the following contents to the file. Replace 192.0.2.100 with your actual Milvus load balancer IP Address
Save and exit the file.
The above application file connects to your Milvus service from your local terminal as the Milvus user root user and the password Milvus since the cluster authorizationEnabled field is set to true.
In addition, the application creates a book database and prints all the available databases. You can create a maximum of up to 64 Milvus databases on top of the default database to manage user privileges within the database.
Run the application
When successful, your output should look like the one below:
As displayed in the above output, a new database is created that confirms a connection to the Milvus cluster is working correctly. You can perform more functions such as creating collections and vector searches.
In this section, scale your Milvus Cluster by increasing and decreasing the number of replica pods running in your cluster. Scaling is important when managing resource allocation depending on your user traffic requirements.
To increase the number of pods, Edit the milvus_cluster.yaml file
Change the queryNode: replicas value to 4 to set a new number of replica pods
Save and close the file.
Apply the change to your cluster
Output:
View the list of running Milvus Cluster pods
Verify that the milvus-querynode pods are at least 4 similar to the output below:
Modify the milvus_cluster.yaml file to decrease the number of pods
Reduce the number of queryNode replicas to 2
Save and close the file.
Apply the change to your cluster
Output:
View the list of running pods
Verify that the milvus-querynode pods are 2 instead of 4 similar to the output below:
MilvusDB creates at least 20 high performance Vultr block storage volumes on your account. If multiple volumes fail or get deleted, your Milvus Cluster may run into errors. To keep track of your account billing and MilvusDB resources, verify the available storage volumes on your Vultr account as described in the steps below.
Visit the Vultr Console
Click Products
Expand the Cloud Storage group and click Block Storage from the list of options
Verify the available MilvusDB storage volumes with the pvc naming scheme
Depending on your Milvus Cluster deployment, you may encounter errors based on the following Milvus DB issues:
A Milvus Cluster requires at least 20 Vultr Block Storage volumes, verify that enough volumes are attached to your account to avoid any resource limitation errors.
In case your Milvus cluster pods are not not running. Describe the target pod to view any error logs using the command below
The above command displays detailed information about a specific pod in your Milvus cluster. The information may include the status, events, namespace, and IP address information.
Verify that the Milvus Cluster storage volumes are healthy and running
The above command displays a summary of the cluster Persistent Volume Claims (PVCs). Verify that all available PVCs are running correctly
If you receive an authentication error while creating a new database, verify the user, Milvus Address, and password details in your Python application file.
You have deployed a Milvus Cluster using the Milvus operator on a Vultr Kubernetes Engine (VKE) cluster. Then, you created an external service by exposing the database server outside the cluster and tested access to the service by creating a new database. For more information, visit the Milvus DB documentation.
To install other database systems to your VKE cluster, visit the following resources:
0 Comments
Be the first to comment and share your perspective with the community.