关于人工智能:Milvus-Lite-已交卷轻量版-Milvus主打就是一个轻便无负担

11次阅读

共计 3824 个字符,预计需要花费 10 分钟才能阅读完成。

想要体验世界上最快的向量数据库?短少业余的工程师团队作为撑持?Milvus 装置环境受限?

别放心,轻量版 Milvus 来啦!

在正式介绍 Milvus Lite 之前,先简略回顾一下 Milvus。Milvus 是一款开源的向量数据库,专门用于索引、存储以及查问那些由深度神经网络和其余机器学习(ML)模型生成的向量,反对十亿级别的数据规模,已成为许多公司、钻研人员和开发者解决大规模数据集相似性搜寻的首选工具。

不过,也有用户反馈刚开始接触 Milvus 或者想要在 Notebook 中进行疾速试验时,装置或部署 Milvus 有些力不从心。 为此,Milvus 社区的 Committer 嵇斌开发出 Milvus Lite,即 Milvus 的轻量级版本,不便有相干需要的用户进行体验。能够这样了解,Milvus Lite 为没有业余运维团队撑持、装置部署环境受限的群体提供了新的可能。

Milvus Lite 的劣势

作为 Milvus 的轻量级版本,Milvus Lite 有不少劣势,例如:

  • 能够轻松将 Milvus Lite 集成到 Python 应用程序中,不须要任何其余依赖项;
  • 能够作为 library 导入到其余 Python 程序中,并应用命令行接口(CLI);
  • 与 Google Colab 和 Jupyter Notebook 的集成变得更容易;
  • 平安迁徙,利用程序代码和数据都能够丝滑地迁徙到 Milvus 集群或 Zilliz Cloud 中。

Milvus Lite 的适配场景

Milvus Lite 的典型应用场景:

  • 用户在应用 Milvus 的过程中不方便使用 K8s、容器等技术工具(例如 Milvus Operator,Helm 或 Docker Compose)时;
  • 想要将 Milvus 的性能集成到 Python 应用程序中;
  • 想在 Colab 或 Notebook 中进行疾速试验时迅速启动 Milvus 实例。

须要留神的是,咱们不举荐在任何生产环境中应用 Milvus Lite,也不举荐在须要高性能、高可用性或高可扩展性时的场景下应用 Milvus Lite。相同,当大家有相似需要时,咱们更举荐 Milvus 集群或 Zilliz Cloud(提供开箱即用的向量数据库服务,6 月底行将登陆阿里云 )进行部署。

如何装置、部署和应用 Milvus Lite?

筹备工作

在正式装置 Milvus Lite 以前,须要做足以下筹备:

  • 装置 Python 3.7 或更高版本。
  • 应用下述任何一个通过验证的操作系统:Ubuntu >= 20.04 (x86\_64);CentOS >= 7.0 (x86\_64);MacOS >= 11.0 (Apple Silicon)

值得注意的是,Milvus Lite 用 manylinux2014 作为根底镜像,以便与 Linux 用户的大多数发行版兼容。

装置 Milvus Lite

  • Milvus Lite 能够在 PyPI 中下载安装,咱们能够通过 pip 进行装置。
$ python3 -m pip install milvus
  • 或者大家也能够通过 PyMilvus 进行装置,具体操作如下:
$ python3 -m pip install milvus[client]

应用并启动 Milvus Lite

从咱们的我的项目库的示例文件夹中下载示例代码(https://github.com/milvus-io/milvus-lite/tree/main/examples)。有两种形式能够应用 Milvus Lite:将其作为 Python 库导入或用 CLI 在机器上将它作为独立服务器运行。

  • 将 Milvus Lite 作为 Python 模块启动,执行以下命令:
from milvus import default_serverfrom pymilvus import connections, utility# Start your milvus serverdefault_server.start()# Now you can 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())# Stop your milvus serverdefault_server.stop()

大家也能够将 server 实例,放在 with 语句的上下文中,以实现主动启停:

from milvus import default_serverwith default_server:  # Milvus Lite has already started, use default_server here.  connections.connect(host='127.0.0.1', port=default_server.listen_port)
  • 通过 CLI 来启动 Milvus Lite,执行以下命令:
milvus-server

启动 Milvus Lite 后,大家就能够应用 PyMilvus 或本人棘手的工具来连贯独立服务器了。

用调试模式启动 Milvus Lite

  • 将 Milvus Lite 作为 Python 模块以调试模式运行,执行以下命令:
from milvus import debug_server, MilvusServerdebug_server.run()# Or you can create a MilvusServer by yourself# server = MilvusServer(debug=True)
  • 在调试模式下运行 Milvus Lite,请执行以下命令:
milvus-server --debug

长久化数据和日志

  • 执行以下命令创立一个本地目录,用于存储所有相干的 Milvus Lite 数据和日志:
 from milvus import default_serverwith default_server:  default_server.set_base_dir('milvus_data')
  • 为了将 Milvus Lite 生成的所有数据和日志保留在本地磁盘上,执行以下命令:
 $ milvus-server --data milvus_data

配置 Milvus Lite

配置 Milvus Lite 与应用 Python API 或 CLI 设置 Milvus 的实例类似。

  • 用 Python API 配置  Milvus Lite,能够应用 MilvusServer 实例的 config.set 来设置根本和额定的设置:
from milvus import default_serverwith default_server:  default_server.config.set('system_Log_level', 'info')  default_server.config.set('proxy_port', 19531)  default_server.config.set('dataCoord.segment.maxSize', 1024)
  • 用 CLI 配置 Milvus Lite,运行以下命令进行根本设置:
$ milvus-server --system-log-level info$ milvus-server --proxy-port 19531
  • 或者,运行以下命令以进行额定配置:
$ milvus-server --extra-config dataCoord.segment.maxSize=1024

所有配置参数都在 Milvus 工具包中附带的 config.yaml 模板中。想理解更多对于装置和配置 Milvus Lite 的技术细节,能够点击查看 https://milvus.io/docs/milvus\_lite.md#Prerequisites

总结

总体而言,无论用户是何种身份(钻研人员、开发者或者数据科学家),Milvus Lite 都是一个不错的抉择,尤其对于那些想要在受限的环境中应用 Milvus 性能的用户而言,更是如此。

Milvus Lite 是开源社区或者说开源文化下的产物,背地折射出的是开发者们对于开源的酷爱。在此,咱们尤其要感激 Milvus 社区 Committer 嵇斌,没有他就没有 Milvus Lite!咱们也期待有更多开发者参加进来,和咱们一起探讨 Milvus 的将来,在这个极具创新性与发展性的集市模式的加持下,Milvus 肯定会变得越来越好,从而更好地满足用户的需要。

最初,如果大家在装置或应用 Milvus Lite 时遇到问题,能够点击链接提交问题,https://github.com/login?return\_to=https\%3A\%2F\%2Fgithub.com\%2Fmilvus-io\%2Fmilvus-lite\%2Fissues\%2Fnew,当然也能够扫码退出 Zilliz 技术交换群,咱们的业余工程师将全程在线,为大家答疑解惑。

🌟留神!全托管 Milvus SaaS/PaaS 行将上线,由 Zilliz 原厂打造!笼罩阿里云、百度智能云、腾讯云、金山云。目前已反对申请试用,企业用户 PoC 申请或其余商务单干请分割 business@zilliz.com。


  • 如果在应用 Milvus 或 Zilliz 产品有任何问题,可增加小助手微信“zilliz-tech”退出交换群。
  • 欢送关注微信公众号“Zilliz”,理解最新资讯。

本文由 mdnice 多平台公布

正文完
 0