Introducing Milvus Lite: the Lightweight Version of Milvus
Milvus is an open-source vector database purpose-built to index, store, and query embedding vectors generated by deep neural networks and other machine learning (ML) models at billions of scales. It has become a popular choice for many companies, researchers, and developers who must perform similarity searches on large-scale datasets.
However, some users may find the full version of Milvus too heavy or complex. To address this problem, Bin Ji, one of the most active contributors in the Milvus community, built Milvus Lite, a lightweight version of Milvus.
As previously mentioned, Milvus Lite is a simplified alternative to Milvus that offers so many advantages and benefits.
- You can integrate it into your Python application without adding extra weight.
- It is self-contained and does not require any other dependencies, thanks to the standalone Milvus' ability to work with embedded Etcd and local storage.
- You can import it as a Python library and use it as a command-line interface (CLI)-based standalone server.
- It works smoothly with Google Colab and Jupyter Notebook.
- You can safely migrate your work and write code to other Milvus instances (standalone, clustered, and fully-managed versions) without any risk of losing data.
Specifically, Milvus Lite is most helpful in the following situations:
- When you prefer to use Milvus without container techniques and tools like Milvus Operator, Helm, or Docker Compose.
- When you don't require virtual machines or containers for using Milvus.
- When you want to incorporate Milvus features into your Python applications.
- When you want to spin up a Milvus instance in Colab or Notebook for a quick experiment.
Note: We do not recommend using Milvus Lite in any production environment or if you require high performance, strong availability, or high scalability. Instead, consider using Milvus clusters or fully-managed Milvus on Zilliz Cloud for production.
Now, let’s take a look at how to install, configure, and use Milvus Lite.
To use Milvus Lite, please ensure you have completed the following requirements:
- Installed Python 3.7 or a later version.
- Using one of the verified operating systems listed below:
- Ubuntu >= 18.04 (x86_64)
- CentOS >= 7.0 (x86_64)
- MacOS >= 11.0 (Apple Silicon)
- Milvus Lite uses
manylinux2014as the base image, making it compatible with most Linux distributions for Linux users.
- Running Milvus Lite on Windows is also possible, although this has yet to be fully verified.
Milvus Lite is available on PyPI so you can install it via
$ python3 -m pip install milvus
You can also install it with PyMilvus as follows:
$ python3 -m pip install milvus[client]
Download the example notebook from our project repository's example folder. You have two options for using Milvus Lite: either import it as a Python library or run it as a standalone server on your machine using the CLI.
- To start Milvus Lite as a Python module, execute the following commands:
from milvus import default_server from pymilvus import connections, utility # Start your milvus server default_server.start() # Now you can connect with localhost and the given port # Port is defined by default_server.listen_port connections.connect(host='127.0.0.1', port=default_server.listen_port) # Check if the server is ready. print(utility.get_server_version()) # Stop your milvus server default_server.stop()
- To suspend or stop Milvus Lite, use the
from milvus import default_server with default_server: # Milvus Lite has already started, use default_server here. connections.connect(host='127.0.0.1', port=default_server.listen_port)
- To start Milvus Lite as a CLI-based standalone server, run the following command:
After you start Milvus Lite, you can use PyMilvus or other tools you prefer to connect to the standalone server.
- To run Milvus Lite in a debug mode as a Python Module, execute the following commands:
from milvus import debug_server, MilvusServer debug_server.run() # Or you can create a MilvusServer by yourself # server = MilvusServer(debug=True)
- To run the standalone server in a debug mode, execute the following command:
- To create a local directory for Milvus Lite that will contain all relevant data and logs, execute the following commands:
from milvus import default_server with default_server: default_server.set_base_dir('milvus_data')
- To persist all data and logs generated by the standalone server on your local drive, run the following command:
$ milvus-server --data milvus_data
Configuring Milvus Lite is similar to setting up Milvus instances using Python APIs or CLI.
- To configure Milvus Lite using Python APIs, use the
config.setAPI of a
MilvusServerinstance for both the basic and extra settings:
from milvus import default_server with default_server: default_server.config.set('system_Log_level', 'info') default_server.config.set('proxy_port', 19531) default_server.config.set('dataCoord.segment.maxSize', 1024)
- To configure Milvus Lite using CLI, run the following command for basic settings:
$ milvus-server --system-log-level info $ milvus-server --proxy-port 19531
- Or, run the following for extra configurations.
$ milvus-server --extra-config dataCoord.segment.maxSize=1024
All configurable items are in the
config.yaml template shipped with the Milvus package.
For more technical details on how to install and configure Milvus Lite, see our documentation.
Milvus Lite is an excellent choice for those seeking the capabilities of Milvus in a compact format. Whether you are a researcher, developer, or data scientist, it's worth exploring this option.
Milvus Lite is also a beautiful addition to the open-source community, showcasing the extraordinary work of its contributors. Thanks to Bin Ji's efforts, Milvus is now available to more users. We cannot wait to see the innovative ideas that Bin Ji and other members of the Milvus community will bring forth in the future.
If you encounter problems installing or using Milvus Lite, you can file an issue here or contact us through Twitter or LinkedIn. You're also welcome to join our Slack channel to chat with our engineers and the entire community, or check out our Tuesday office hours!
Like the article? Spread the word
Revealing Milvus 2.3.2 & 2.3.3: Support for Array Data Types, Complex Delete, TiKV Integration, and More
Ingesting Chaos: The MLOps Behind Handling Unstructured Data Reliably at Scale for RAG
Unveiling Milvus 2.3: A Milestone Release Offering Support for GPU, Arm64, CDC, and Many Other Highly Anticipated Features