• Stars
    star
    274
  • Rank 150,274 (Top 3 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 2 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A lightweight version of Milvus

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-server

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.

More Repositories

1

milvus

A cloud-native vector database, storage for next generation AI applications
Go
29,817
star
2

bootcamp

Dealing with all unstructured data, such as reverse image search, audio search, molecular search, video analysis, question and answer systems, NLP, etc.
HTML
1,827
star
3

pymilvus

Python SDK for Milvus.
Python
993
star
4

milvus-sdk-java

Java SDK for Milvus.
Java
384
star
5

milvus-sdk-go

Go SDK for Milvus.
Go
338
star
6

knowhere

Knowhere is an open-source vector search engine, integrating FAISS, HNSW, etc.
C++
201
star
7

milvus-sdk-node

The Official Mivus node.js sdk(client)
TypeScript
123
star
8

web-content

Milvus web documents and contents
MDX
120
star
9

milvus-insight

Milvus management GUI
TypeScript
90
star
10

milvus-sdk-csharp

C# SDK for Milvus.
C#
88
star
11

milvus-helm

The helm chart to deploy Milvus
Mustache
78
star
12

milvus-docs

This repository is for Milvus technical documentation update and maintenance. Visit Milvus.io for fully rendered technical documents.
Python
72
star
13

milvus-tools

A data migration tool for Milvus.
Python
69
star
14

milvus-operator

milvus-operator
Go
61
star
15

milvus-sdk-rust

Rust SDK for Milvus.
Rust
58
star
16

birdwatcher

Go
44
star
17

milvus.io

Milvus official website.
TypeScript
43
star
18

milvus-sdk-cpp

C++ SDK for Milvus 2.0
C++
36
star
19

milvus_cli

Milvus Command Line
Python
33
star
20

community

Where community members can share ideas, collaborate and learn from each other.
32
star
21

milvus-proto

Share Milvus proto files between Milvus repository and SDK repositories
Shell
24
star
22

pymilvus-orm

Python
20
star
23

milvus-model

The embedding/reranking model zoo help user to convert their unstructured data into embeddings
Python
19
star
24

milvus-storage

Milvus file storage format repo
C++
19
star
25

milvus-tutorials

milvus tutorials
19
star
26

milvus-haystack

Python
8
star
27

milvus-demo-chat-bot

TypeScript
7
star
28

milvus-demo-image-search

JavaScript
7
star
29

milvusctl

Go
5
star
30

hero-bot

extract heros (contributor) from repo
JavaScript
5
star
31

homebrew-milvus

homebrew for milvus ecosystem
Ruby
2
star
32

conanfiles

Conanfiles for managing third-party packages that Milvus depends on
Python
2
star
33

provider-milvus

milvus provider for crossplane
Go
2
star
34

milvus-demo-movie-taste

JavaScript
2
star
35

milvus-demo-video-search

JavaScript
2
star
36

milvus-rpm

Build rpm package for milvus
Shell
1
star
37

milvus-deb

Shell
1
star
38

pymilvus-assets

Large models, etc. for pymilvus
1
star