MongoDB Search enables full-text search capabilities in your Kubernetes environment by deploying the mongot process alongside your MongoDB database deployment (mongod). The mongot process manages search indexes, sources data from the database, and processes $search and $searchMeta queries. This eliminates the need to maintain separate search systems while providing advanced search features.
要部署 MongoDB Search,您需要应用 MongoDBSearch 自定义资源 (CR),Kubernetes 操作符会获取该资源并使用它来部署 mongot pod 并请求 spec 中指定的持久化存储。
有关部署程序,请参阅部署 MongoDB Search 和向量搜索。
mongot 进程
每个 mongot进程都有自己的持久卷,不与数据库或其他搜索节点共享。存储用于维护根据持续源自数据库的数据构建的索引。索引定义(元数据)存储在数据库中。
mongot 执行以下操作:
管理索引。
mongot负责更新数据库中的索引定义。从数据库中获取数据。
mongot节点与数据库建立永久连接,以便实时更新数据库中的索引。处理搜索查询。
When
mongodreceives a$searchor$searchMetaquery, 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.
The mongot components are tightly coupled with a single MongoDB replica set and cannot be shared across multiple databases or replica sets. Each replica set deployment has its own dedicated search nodes. To learn more about Search node architecture, see Node Architecture in the MongoDB Search documentation.
网络
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的 MongoDB Search 有状态设立,并根据 CR 中的spec.persistence和spec.resourceRequirements配置存储和资源要求。通过添加必要的
setParameter选项(包括mongot主机的主机名和端口号)来更新每个mongod进程的配置。
外部 MongoDB 部署
当 MongoDB 副本集在 Kubernetes 外时,您使用 Kubernetes 操作符部署 mongot,并手动执行一些步骤。Kubernetes 操作符处理搜索节点的配置,但您必须重新配置 MongoDB 节点和网络。
安全性
如果 MongoDB 服务器在 Kubernetes 集群内,Kubernetes 操作符会自动为 MongoDB Search 设置密钥文件身份验证。如果 MongoDB 服务器是外部的,则必须创建一个 kubernetes secret,其中包含副本集的密钥文件凭证,并在 MongoDBSearch CR 中引用它。
限制
您无法在以下架构上部署 MongoDB Search:
IBM Power (ppc64le)
IBM Z (s390x)
提示
部署 MongoDB Search 和向量搜索 — 部署 MongoDB Search 和向量搜索
MongoDB Search 和向量搜索设置 — MongoDBSearch CR 设置