Host types in Yandex StoreDoc
Yandex StoreDoc has these four host types: MONGOD, MONGOINFRA, MONGOCFG, and MONGOS. Each host type has a role and functions of its own in the cluster. The type and number of hosts in a Yandex StoreDoc cluster depend on what sharding type you select.
Roles and functions of different host types
-
MONGOD: Data storage and query processing hosts. These hosts are present in both sharded and non-sharded clusters.Primary functions of
MONGODhosts:- Read and write request processing.
- User data storage.
- Data replication.
- Ensuring data consistency.
-
MONGOCFG: Sharding configuration hosts. These hosts are present only in clusters with advanced sharding.Primary functions of
MONGOCFGhosts:- Storing and updating sharding metadata on changes in the shard configuration.
- Providing
MONGOShosts with up-to-date information about chunks and shards. - Coordinating chunk migration between shards.
-
MONGOS: Router hosts. These hosts are present only in clusters with advanced sharding.Primary functions of
MONGOShosts:- Accepting client connections.
- Routing queries to shards.
- Processing of query or subquery results.
- Delivery of final output to the client.
-
MONGOINFRA: Infrastructure hosts. This host type combines theMONGOSandMONGOCFGroles.MONGOINFRAhosts are present only in clusters with standard sharding.Primary functions of
MONGOINFRAhosts:- Accepting client connections.
- Routing queries to shards.
- Storing and updating sharding metadata on changes in the shard configuration.
- Coordinating chunk migration between shards.
- Processing of query or subquery results.
- Delivery of final output to the client.
Cluster composition depending on sharding type
The number of hosts of various types in an Yandex StoreDoc cluster depends on sharding type:
| Sharding type | MONGOD | MONGOINFRA | MONGOS | MONGOCFG |
|---|---|---|---|---|
| No sharding | ⩾ 1 | — | — | — |
| Standard | ⩾ 1 | ⩾ 3 | — | — |
| Advanced | ⩾ 1 | — | ⩾ 2 | ⩾ 3 |
A non-sharded cluster consists exclusively of MONGOD hosts that process all client requests. Query routing is managed by the Yandex StoreDoc client.
A standard-sharded cluster consists of MONGOD and MONGOINFRA hosts.
Client requests addressed to the cluster are processed as follows:
- The Yandex StoreDoc client connects to all
MONGOINFRAhosts and sends the request to one of them. - The
MONGOINFRAhost analyzes the request and figures out what shards are affected by it. - The
MONGOINFRAhost forwards the request or the group of subrequests to relevantMONGODhosts. MONGODhosts execute the request or subrequests.- The
MONGOINFRAhost processes the result of the request or subrequests and returns the final result to the client.
A cluster with advanced sharding consists of MONGOD, MONGOS, and MONGOCFG hosts.
Client requests addressed to the cluster are processed as follows:
- The Yandex StoreDoc client connects to all
MONGOShosts and sends the request to one of them. - The
MONGOShost analyzes the request and uses metadata fromMONGOCFGhosts to figure out what shards are affected by it. - The
MONGOShost forwards the request or the group of subrequests to relevantMONGODhosts. MONGODhosts execute the request or subrequests.- The
MONGOShost processes the result of the request or subrequests and returns the final result to the client.