...
PRs: TBD Keywords: embedded, python, deep learning,
Released: <Milvus Release Version>Milvus 2.1
Motivation
According to Milvus official document, there are many ways to install and start Milvus on your machine, including:
...
Code Block | ||||
---|---|---|---|---|
| ||||
>>> import rocksdb >>> db = rocksdb.DB("test.db", rocksdb.Options(create_if_missing=True)) >>> db.put(b'a', b'data') >>> print db.get(b'a') b'data' | ||||
|
Summary
We introduce embedded Milvus in this MEP.
With embedded Milvus, you just need a clean environment with Python installed. You can then just do:
...
The Milvus service usually takes tens of seconds to fully start (which we will optimize later). It is a good idea to keep a background thread with running Milvus who should always stand ready to answer user's calls.
...
Logging should be suppressed during the embedded Milvus run, otherwise your program can easily get flooded with logs. We propose that all logs, no matter which level, should not be printed to the console.
Working with Pymilvus
Pymilvus is an essential part of Milvus and still the most popular SDK. Plus it has the beautiful name,
. And that is the perfect name we would like to steal for embedded milvus.pymilvusFrom a certain point onwards, we could embed the embedded miluvs project in pymilvus. It won't change much to pymilvus's existing use case, but will support embedded milvus.
Pymilvus is an essential part of Milvus and still the most popular SDK. Embedded Milvus works with Pymilvus in the following ways:
...
- Install Docker.
- Start a Milvus instance with all its dependencies (MinIO, Etcd and Pulsar if running Milvus cluster) with
docker-compose up
. - Install pymilvus with "pip install pymilvus". (what, do you guys not have Python?)
- From pymilvus, connect to the Milvus instance you just brought up in 2.
Code Block language py linenumbers true connections.connect("default", host="localhost", port="19530")
- Start playing with Milvus. Enjoy your time.
- Shut down Milvus with
docker-compose down
.
...
- Install Pymilvus with "pip install pymilvus".
Import embedded Milvus with:
Code Block language py linenumbers true from ... import milvus # Milvus will start.
- Start playing with Milvus. Again, enjoy your time.
exit()
if you are in Python interactive mode, otherwise your Python script should already finish gracefully.
...