When designing MongoDB systems that utilize MongoDB Search and MongoDB Vector Search, there are two common deployment types:在设计使用MongoDB搜索和MongoDB矢量搜索的MongoDB系统时,有两种常见的部署类型:
A co-located architecture where一种共置架构,其中mongodandmongotprocesses share the same host. This architecture is suitable for development and small search or vector search workloads.mongod和mongot进程共享同一主机。这种架构适用于开发和小型搜索或矢量搜索工作负载。A dedicated infrastructure model where一种专用的基础架构模型,其中mongodandmongotprocesses run on separate machines, each sized according to the needs of each workload. This infrastructure is recommended for applications that demand high availability, sharding, or substantial search or vector workloads with heavy search queries and indexing.mongod和mongot进程在单独的机器上运行,每台机器的大小根据每个工作负载的需求而定。建议将此基础架构用于需要高可用性、分片或大量搜索或矢量工作负载以及繁重搜索查询和索引的应用程序。
This section describes both deployment types. It also describes the implications of deploying 本节介绍这两种部署类型。它还描述了在分片MongoDB集群中部署mongot in sharded MongoDB clusters.mongot的含义。
Co-Located Architecture共置建筑
This is the simplest architecture, recommended for development environments or any situation that requires quick iteration. It excels in rapid prototyping and requires the least amount of configuration.这是最简单的架构,建议用于开发环境或任何需要快速迭代的情况。它擅长快速原型制作,需要最少的配置。
The deployment consists of a single machine running both 部署由一台运行mongod and mongot processes. All communication can take place over localhost addresses, and all authentication and security features can be disabled or made more permissive.mongod和mongot进程的机器组成。所有通信都可以通过localhost地址进行,所有身份验证和安全功能都可以被禁用或变得更加宽松。
For most small search workloads, you can expand this architecture to a multi-node replica set. Use caution when implementing a co-located architecture, and monitor for signs of resource contention.对于大多数小型搜索工作负载,您可以将此架构扩展到多节点副本集。在实施共置架构时要小心,并监控资源争用的迹象。

Dedicated Infrastructure专用基础设施
This is a general-purpose architecture, recommended for production environments. Dedicated infrastructure accommodates both horizontal and vertical scalability for both the database nodes and search nodes.这是一种通用架构,建议用于生产环境。专用基础设施为数据库节点和搜索节点提供了水平和垂直的可扩展性。
The deployment consists of at least three machines running 该部署由至少三台在副本集配置中运行mongod in a replica set configuration, and at least two machines running mongot. To provide high availability when querying Search, the mongod nodes require an application-level load balancer. Consider a load balancer like Envoy, and use a load balancing strategy such as per-request round-robin.mongod的机器和至少两台运行mongot的机器组成。为了在查询搜索时提供高可用性,mongod节点需要一个应用程序级负载均衡器。考虑像Envoy这样的负载均衡器,并使用按请求轮询等负载平衡策略。
No load balancing is required in the opposite direction. 相反方向不需要负载平衡。mongot automatically chooses a mongod node to communicate with for data replication and the index catalog data based on its configuration.mongot根据其配置自动选择一个mongod节点进行数据复制和索引目录数据通信。

Sharded Topology分片拓扑
This architecture is similar to the dedicated infrastructure architecture, but the replica set configuration is duplicated to each individual shard.这种架构类似于专用基础架构,但副本集配置被复制到每个单独的分片。
Note
Even though you should only configure 即使你应该只配置mongot to replicate from one shard, mongot still requires the router address to be configured in order to access the index catalog.mongot从一个分片复制,mongot仍然需要配置路由器地址才能访问索引目录。
With the sharded topology architecture, 在分片拓扑架构中,mongot only belongs to a single shard at a time. As a result, load balancers within each shard should only be configured to direct traffic to that individual shard.mongot一次只属于一个分片。因此,每个分片内的负载平衡器只应配置为将流量引导到单个分片。
If you add shards to a collection with an existing MongoDB Search index, an initial sync occurs on the newly added shards for that MongoDB Search index. Each shard's MongoDB Search index contains only the documents from the collection that exist on that shard. 如果将分片添加到具有现有MongoDB搜索索引的集合中,则会在该MongoDB搜索索引新添加的分片上进行初始同步。每个分片的MongoDB搜索索引仅包含该分片上存在的集合中的文档。To learn more, see Shard a Global Collection.要了解更多信息,请参阅分片某个全局集合。
Warning
If you shard a collection that already has a MongoDB Search index, you might experience a period of search query downtime while the index builds on the new shards.如果你对一个已经有MongoDB搜索索引的集合进行分片,在索引构建在新分片上时,你可能会经历一段搜索查询停机时间。
Also, if you add a shard for an already sharded collection that contains a MongoDB Search index, your search queries against that collection will fail until the initial sync process completes on the added shards. 此外,如果您为包含MongoDB搜索索引的已分片集合添加分片,则对该集合的搜索查询将失败,直到对添加的分片完成初始同步过程。To learn more, see troubleshoot-initial-sync.要了解更多信息,请参阅初始同步故障排除。
