GithubHelp home page GithubHelp logo

matrixji / python-milvus-server Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 1.0 6.17 MB

Start milvus server in python

License: Apache License 2.0

Python 67.73% Shell 28.74% Dockerfile 3.53%
milvus vector-database

python-milvus-server's Introduction

Python Milvus Server

Note:

PyPI Version

Milvus server started by python

Currently, windows/linux with x86_64, and macOS with arm64 is supported.

Installation

You could simply install it with pip:

pip install python-milvus-server

or with a specific version

pip install python-milvus-server==2.2.2

or install it from the source.

Install from source

Windows

Currently, Milvus windows is build with MSYS2, so please follow below steps for build and install this Milvus server for windows.

  • Install MSYS2, currently please use msys2-base-x86_64-20220603, which could be found at MSYS2 Install Release
  • In MINGW64 console, run the prebuild scripts: sh run-prebuild.sh, after that, you could find all needed dll files under folder milvus/bin
  • Using setup.py to install python-milvus-server
    • python setup.py install to install it.
    • python setup.py bdist_wheel to build binary package (wheel and setuptools is required).

Linux

Currently, compile milvus on linux requires install some dependencies, so we create a docker for build the milvus executable.

  • On any linux with python3 installed, docker is installed and started.
  • run the prebuild scripts: bash run-prebuild.sh, after that, you should find all needed binaries under folder milvus/bin
  • Using setup.py to install python-milvus-server
    • python setup.py install to install it.
    • python setup.py bdist_wheel to build binary package (wheel and setuptools is required).

macOS

Similar with under Linux, but you need to install the dependencies on your macos by yourself. It could be done with scripts/install_deps.sh from milvus.

Usage

You could load the default_server and start it.

from milvus_server import default_server
from pymilvus import connections

# Optional, if you want store all related data to specific location
# default it wil using:
#   %APPDATA%/milvus-io/milvus-server on windows
#   ~/.milvus-io/milvus-server on linux
default_server.set_base_dir('D:\\test_milvus')

# Optional, if you want cleanup previous data
default_server.cleanup()

# star you milvus server
default_server.start()

# Now you could connect with localhost and the port
# The port is in default_server.listen_port
connections.connect(host='127.0.0.1', port=default_server.listen_port)

You could see example.py for a full example.

Some advanced topic

Debug startup

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

from milvus_server import debug_server

and you could also try create server instance by your self

from milvus_server import MilvusServer

server = MilvusServer(debug=True)

Multiple instance

Yes, we support multiple milvus server instance. Currently windows only(due to pid file path is hardcoded on linux) note: as by default they're using the same data dir, you set different data dir for each instances

from milvus_server import MilvusServer

server1 = MilvusServer()
server2 = MilvusServer()

# this is mandatory
server1.set_base_dir('d:\\test_1')
server2.set_base_dir('d:\\test_2')

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_server import default_server

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

python-milvus-server's People

Contributors

matrixji avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

abdulrahman305

python-milvus-server's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.