MongoDB Vector Search enables AI-powered semantic search capabilities in your Kubernetes environment by deploying the mongot process alongside your MongoDB database deployment (mongod). The mongot process manages vector indexes, sources data from the database, and processes $vectorSearch queries. This eliminates the need to maintain separate systems in sync while providing advanced search features.
要部署 Vector Search,可应用MongoDBSearch 自定义资源 (CR),Kubernetes Operator 会接收并使用该资源部署 mongot 节点并请求 spec 中指定的持久性存储。
有关部署程序,请参阅部署 MongoDB Search 和向量搜索。
mongot 进程
每个 mongot 进程都有自己的持久卷,该卷不与数据库或其他搜索节点共享。存储用于维护从数据库连续获取的数据构建的向量索引。索引定义(元数据)存储在数据库本身中。
mongot 执行以下操作:
管理向量索引。
mongot负责更新数据库中的索引定义。从数据库中获取数据。
mongot节点与数据库建立永久连接,以便实时更新数据库中的索引。处理向量搜索查询。
When
mongodreceives a$vectorSearchquery, it directs the query to one of themongotnodes. Themongotthat receives the query processes the query, aggregates the data, and returns the results tomongod, which forwards the results to the user.
mongot 组件与单个 MongoDB 副本集紧密耦合,不能在多个数据库或副本集之间共享。每个副本集部署都有自己的专用搜索节点。
网络
mongot 和 mongod 之间的网络连接是双向的:
mongot建立与副本集的连接,以获取用于构建索引和运行查询的数据。mongod连接到mongot以转发索引管理和查询数据等搜索相关操作。
mongod 充当所有搜索查询的代理。您从不会直接与 mongot 交互。
操作符托管的部署
当 mongot 和 mongod 进程同时部署在Kubernetes集群内时,Kubernetes 操作符 会自动为这两个进程执行配置。具体来说,Kubernetes Operator:
找到 MongoDBSearch 使用
spec.source.mongodbResourceRef引用的 MongoDB CR,或通过命名规范查找与 MongoDBSearch 名称相同的 MongoDB CR。生成
mongot配置,将其保存到 YAML 文件中,并将该文件内容保存到名为<MongoDBSearch.metadata.name>-search-config的配置映射中。部署名为
<MongoDBSearch.metadata.name>-search的 Vector Search 有状态设立,并根据 CR 中的spec.persistence和spec.resourceRequirements配置存储和资源要求。通过添加必要的
setParameter选项(包括mongot主机的主机名和端口号)来更新每个mongod进程的配置。
外部 MongoDB 部署
当 MongoDB 副本集在 Kubernetes 外时,您使用 Kubernetes 操作符部署 mongot,并手动执行一些步骤。Kubernetes 操作符处理搜索节点的配置,但您必须重新配置 MongoDB 节点和网络。
安全性
如果MongoDB服务器位于Kubernetes集群内,则Kubernetes Operator 会自动为 Vector Search 设置密钥文件身份验证。如果MongoDB服务器位于外部,则必须创建一个包含副本集密钥文件档案的Kubernetes密钥,并在 MongoDBSearch CR 中引用它。
限制
您无法在以下架构上部署向量搜索:
IBM Power (ppc64le)
IBM Z (s390x)
提示
部署 MongoDB Search 和向量搜索 — 部署 MongoDB Search 和向量搜索
MongoDB Search 和向量搜索设置 — MongoDBSearch CR 设置