Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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
Code Block
languagepy
linenumberstrue
>>> 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'
languagepy
linenumberstrue

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, pymilvus. And that is the perfect name we would like to steal for embedded milvus.
From 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:

...

  1. Install Docker.
  2. Start a Milvus instance with all its dependencies (MinIO, Etcd and Pulsar if running Milvus cluster) with docker-compose up.
  3. Install pymilvus with "pip install pymilvus". (what, do you guys not have Python?)
  4. From pymilvus, connect to the Milvus instance you just brought up in 2.


    Code Block
    languagepy
    linenumberstrue
    connections.connect("default", host="localhost", port="19530")


  5. Start playing with Milvus. Enjoy your time.
  6. Shut down Milvus with docker-compose down.

...

  1. Install Pymilvus with "pip install pymilvus".
  2. Import embedded Milvus with:

    Code Block
    languagepy
    linenumberstrue
    from ... import milvus # Milvus will start.


  3. Start playing with Milvus. Again, enjoy your time.
  4. exit() if you are in Python interactive mode, otherwise your Python script should already finish gracefully.

...