Skip to main content

Embeded Milvus

Project description

Milvus Lite

PyPI Version

Introduction

Milvus Lite is a lightweight version of Milvus that can be embedded into your Python application. It is a single binary that can be easily installed and run on your machine.

It could be imported as a Python library, as well as use it as a command standalone server.

Thanks to Milvus standalone version could be run with embedded etcd and local storage, Milvus Lite does not have any other dependencies.

Everything you do with Milvus Lite, every piece of code you write for Milvus Lite can be safely migrated to other forms of Milvus (standalone version, cluster version, cloud version, etc.).

Please note that it is not suggested to use Milvus Lite in a production environment. Consider using Milvus clustered or the fully managed Milvus on Cloud.

Requirements

Milvus Lite is available in:

  • Google Colab example
  • Jupyter Notebook

Here's also a list of verified OS types where Milvus Lite can successfully build and run:

  • Ubuntu >= 18.04 (x86_64)
  • CentOS >= 7.0 (x86_64)
  • MacOS >= 11.0 (Apple Silicon)

NOTE

  • For linux we use manylinux2014 as the base image, so it should be able to run on most linux distributions.
  • Milvus Lite can also run on Windows. However, this is not strictly verified.

Installation

Milvus Lite is available on PyPI. You can install it via pip for Python 3.6+:

$ python3 -m pip install milvus

Or, install with client(pymilvus):

$ python3 -m pip install "milvus[client]"

Note: pymilvus now requires Python 3.7+

Usage

Import as Python library

Simply import milvus.default_server.

from milvus import default_server
from pymilvus import connections, utility

# (OPTIONAL) Set if you want store all related data to specific location
# Default location:
#   %APPDATA%/milvus-io/milvus-server on windows
#   ~/.milvus-io/milvus-server on linux
# default_server.set_base_dir('milvus_data')

# (OPTIONAL) if you want cleanup previous data
# default_server.cleanup()

# Start you milvus server
default_server.start()

# Now you could 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())

CLI milvus-server

You could also use the milvus-server command to start the server.

$ milvus-serevr

The full options cloud be found by milvus-server --help.

Advanced usage

Debug startup

You could use debug_server instead of default_server for checking startup failures.

from milvus import debug_server

and you could also try create server instance by your self

from milvus import MilvusServer

server = MilvusServer(debug=True)

If you're using CLI milvus-server, you could use --debug to enable debug mode.

$ milvus-server --debug

Configurations for Milvus

Milvus Lite could set configure by API as well as by CLI. We seperate the configurations into two parts: basic and extra.

The basic configurations

You could find available configurations by milvus-server --help for got the list of basic configurations.

These basic configurations including:

  • Some listen ports for service, e.g. --proxy-port for specifying the port of proxy service.
  • Some storage configurations, e.g. --data for specifying the data directory.
  • Some log configurations. e.g. --system-log-level for specifying the log level.

If you using Python API, you could set these configurations by MilvusServer.config.set method.

# this have the same effect as `milvus-server --system-log-level info`
default_server.config.set('system_log_level', 'info')

All configuable basic configurations could be found in config yaml template, which is installed with milvus package.

The extra configurations

Other configurations are extra configurations, which could also be set by MilvusServer.config.set method.

for example, if we want to set dataCoord.segment.maxSize to 1024, we could do:

default_server.config.set('dataCoord.segment.maxSize', 1024)

or by CLI:

milvus-server --extra-config dataCoord.segment.maxSize=1024

Both of them will update the content of Milvus config yaml with:

dataCoord:
  segment:
    maxSize: 1024

Context

You could close server while you not need it anymore. Or, you're able to using with context to start/stop it.

from milvus import default_server

with default_server:
    # milvus started, using default server here
    ...

Data and Log Persistence

By default all data and logs are stored in the following locations: ~/.milvus.io/milvus-server/VERSION (VERSION is the versiong string of Milvus Lite).

You could also set it at runtime(before the server started), by Python code:

from milvus import default_server
default_server.set_base_dir('milvus_data')

Or with CLI:

$ milvus-server --data milvus_data

Working with PyMilvus

Milvus Lite could be run without pymilvus if you just want run as a server. You could also install with extras client to get pymilvus.

$ python3 -m pip install "milvus[client]"

Examples

Milvus Lite is friendly with jupyter notebook, you could find more examples under examples folder.

Contributing

If you want to contribute to Milvus Lite, please read the Contributing Guide first.

Report a bug

When you use or develop milvus-lite, if you find any bug, please report it to us. You could submit an issue in milvus-lite or report you milvus repo if you think is a Milvus issue.

License

Milvus Lite is under the Apache 2.0 license. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

milvus-2.2.9-py3-none-win_amd64.whl (39.7 MB view details)

Uploaded Python 3Windows x86-64

milvus-2.2.9-py3-none-manylinux2014_x86_64.whl (51.1 MB view details)

Uploaded Python 3

milvus-2.2.9-py3-none-macosx_11_0_arm64.whl (28.4 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

milvus-2.2.9-py3-none-macosx_10_9_x86_64.whl (31.6 MB view details)

Uploaded Python 3macOS 10.9+ x86-64

File details

Details for the file milvus-2.2.9-py3-none-win_amd64.whl.

File metadata

  • Download URL: milvus-2.2.9-py3-none-win_amd64.whl
  • Upload date:
  • Size: 39.7 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.11

File hashes

Hashes for milvus-2.2.9-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 bba50c75d559f0dd1cab9b894a1a67d0f8491a8b24551f48db1991bdd19a7a12
MD5 a9578ddf644286946b78d97187c89b5c
BLAKE2b-256 c81228d2b079f43946ceeb62f3b319cc895fa99efc12d5deab116215d75f120c

See more details on using hashes here.

File details

Details for the file milvus-2.2.9-py3-none-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for milvus-2.2.9-py3-none-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a89197c921b1eb219f7321154043d2a97e88d91d5b63a3656ba624eb920582f9
MD5 2d101a6b5388e7c36bcd25d0f3308fbf
BLAKE2b-256 d3e65644cf36817558a0fad732976ec1381789274d82ad6bef8c761a67de44db

See more details on using hashes here.

File details

Details for the file milvus-2.2.9-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for milvus-2.2.9-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 153c0e845c7ca637fb450f7b629cbbcbf90535913bb7aebc47898aedd5c7ddc4
MD5 034e00d87e0e185b2d6aeb5bd47217ea
BLAKE2b-256 2f07c839c93829260ecb31f57fe8ff163175977049f28a9fdf6779416670dbf4

See more details on using hashes here.

File details

Details for the file milvus-2.2.9-py3-none-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for milvus-2.2.9-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1332cac140a8a97987e27bf7e5e65b12ece92273a6d3ad1721e9534e5663eda8
MD5 4a44bbd6c9bfb63a464e424b6f13e5de
BLAKE2b-256 b5e8f3e543d9b1874787d27abd677929eb21b28cf1f94b04809db91bf8beb5ad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page