What Is Milvus?
Milvus, on the other hand, is a free and open-source vector database that is used to build the machine learning and artificial intelligence applications. Milvus supports massive-scale vector data and high-performance vector similarity search.
Vectors are mathematical representations of objects. Similarity search is finding similar objects based on their vector representations. Vectors are used to power the tools such as image recognition, natural language processors, recommender systems, etc.
This tutorial aims to help you learn how to set up a Milvus database instance on your system using the Docker Compose utility.
Requirements:
In order to follow along with this tutorial, you need the following:
- Ubuntu or Debian-based distribution
- Sudo or root permissions on your system
- Network access to download the containers and dependencies
Once you meet the given requirements, we can proceed with the installation:
NOTE: Although the steps in this tutorial are demonstrated on an Ubuntu system, the method of installing Milvus works on any system with installed Docker.
Installing Docker on Ubuntu
Before installing Milvus, let us install Docker and the required tools on our systems.
The first step is to uninstall any conflicting packages. You can run the following command:
Once completed, run the following command to setup the Docker repositories on your system:
sudo apt-get install ca-certificates curl gnupg wget
Add the Docker official GPG key with the following command:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
$ sudo chmod a+r /etc/apt/keyrings/docker.gpg
To setup the Docker repository, run the following command:
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Once completed, run the following command to update the apt index:
Finally, install the Docker Engine, containerd, and Docker Compose tools by running the following command:
The previous commands should download and configure the Docker engine, containerd, and Docker-compose utility.
Install Milvus Using Docker Compose
The next step is downloading and running Milvus on our system using Docker.
Start by downloading the Docker-compose YAML file for Milvus that allows us to configure a Milvus server:
The previous command should download the “milvus-standalone-docker-compose.yml” from the Milvus Github page and save it in your current working directory as “docker-compose.yml”.
Once we have the Milvus YAML file, run the “docker-compose” command to start the Milvus server as follows:
This command should download the required dependencies and tools to run the Milvus server as defined in the YAML file.
Sample Output:
Creating milvus-minio ... done
Creating milvus-standalone ... done
Once the container creation is complete, the Docker containers will be running on your system including the standalone Milvus server.
You can confirm by running the “docker ps” command:
Example Output:
milvus-etcd quay.io/coreos/etcd:v3.5.5
milvus-minio minio/minio:RELEASE.2022-03-17T06-34-49Z
milvus-standalone milvusdb/milvus:v2.2.9
You should get a more detailed output including port bindings, services, creation time, etc.
Once you are done running the Milvus server, you can shut it down by running the following command:
This should stop all the running containers and shut down the Milvus server.
Conclusion
We discussed how to install Docker and use it to start a standalone Milvus server using the Docker Compose.