Package: milvus
Milvus LiteIntroductionMilvus 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.RequirementsMilvus Lite is available in:Google ColabexampleJupyter NotebookHere'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)NOTEFor linux we use manylinux2014 as the base image, so it should be able to run on most linux distributions.Milvus Lite can also run onWindows. However, this is not strictly verified.InstallationMilvus Lite is available on PyPI. You can install it viapipfor Python 3.6+:$python3-mpipinstallmilvusOr, install with client(pymilvus):$python3-mpipinstall"milvus[client]"Note: pymilvus now requires Python 3.7+UsageImport as Python librarySimply importmilvus.default_server.frommilvusimportdefault_serverfrompymilvusimportconnections,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 serverdefault_server.start()# Now you could connect with localhost and the given port# Port is defined by default_server.listen_portconnections.connect(host='127.0.0.1',port=default_server.listen_port)# Check if the server is ready.print(utility.get_server_version())CLI milvus-serverYou could also use themilvus-servercommand to start the server.$milvus-serverThe full options cloud be found bymilvus-server --help.Advanced usageDebug startupYou could usedebug_serverinstead ofdefault_serverfor checking startup failures.frommilvusimportdebug_serverand you could also try create server instance by your selffrommilvusimportMilvusServerserver=MilvusServer(debug=True)If you're using CLImilvus-server, you could use--debugto enable debug mode.$milvus-server--debugConfigurations for MilvusMilvus Lite could set configure by API as well as by CLI. We seperate the configurations into two parts:basicandextra.The basic configurationsYou could find available configurations bymilvus-server --helpfor got the list ofbasicconfigurations.These basic configurations including:Some listen ports for service, e.g.--proxy-portfor specifying the port of proxy service.Some storage configurations, e.g.--datafor specifying the data directory.Some log configurations. e.g.--system-log-levelfor specifying the log level.If you using Python API, you could set these configurations byMilvusServer.config.setmethod.# 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 configurationsOther configurations areextraconfigurations, which could also be set byMilvusServer.config.setmethod.for example, if we want to setdataCoord.segment.maxSizeto 1024, we could do:default_server.config.set('dataCoord.segment.maxSize',1024)or by CLI:milvus-server--extra-configdataCoord.segment.maxSize=1024Both of them will update the content of Milvus config yaml with:dataCoord:segment:maxSize:1024ContextYou could close server while you not need it anymore.
Or, you're able to usingwithcontext to start/stop it.frommilvusimportdefault_serverwithdefault_server:# milvus started, using default server here...Data and Log PersistenceBy 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:frommilvusimportdefault_serverdefault_server.set_base_dir('milvus_data')Or with CLI:$milvus-server--datamilvus_dataWorking with PyMilvusMilvus Lite could be run without pymilvus if you just want run as a server.
You could also install with extrasclientto get pymilvus.$python3-mpipinstall"milvus[client]"ExamplesMilvus Lite is friendly with jupyter notebook, you could find more examples underexamplesfolder.ContributingIf you want to contribute to Milvus Lite, please read theContributing Guidefirst.Report a bugWhen you use or develop milvus-lite, if you find any bug, please report it to us. You could submit an issue inmilvus-liteor report youmilvusrepo if you think is a Milvus issue.LicenseMilvus Lite is under the Apache 2.0 license. See theLICENSEfile for details.