mongodb mongod 和 mongos 之间的确切区别是什么

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28364778/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 20:17:22  来源:igfitidea点击:

What is the exact difference between mongod and mongos

mongodb

提问by Rajeshwar

While I was looking into the MongoDB documentation, I found two different terms mongodand mongos.

在查看 MongoDB 文档时,我发现了两个不同的术语mongodmongos.

While starting the server, I am using ./mongod --dbpath <path to mongodb>and I am running ./mongoto connect to the server.

在启动服务器时,我正在使用./mongod --dbpath <path to mongodb>并且正在运行./mongo以连接到服务器。

Can someone please clarify the differences between these two terms.

有人可以澄清这两个术语之间的区别吗?

回答by

mongodis the daemon, mongois the client, mongosis the 'MongoDB Shard Utility'. Take a look at man mongos:

mongod是守护进程,mongo是客户端,mongos是“MongoDB Shard Utility”。看看man mongos

mongos for "MongoDB Shard," is a routing service for MongoDB shard configurations that processes queries from the application layer, and determines the location of this data in the sharded cluster, in order to complete these operations. From the perspective of the application, a mongos instance behaves identically to any other MongoDB instance.

mongos 代表“MongoDB Shard”,是 MongoDB 分片配置的路由服务,它处理来自应用层的查询,并确定该数据在分片集群中的位置,以完成这些操作。从应用程序的角度来看,mongos 实例的行为与任何其他 MongoDB 实例相同。

回答by it'sme

The core components in the MongoDB package are: mongod- the core database process; mongos- the controller and query router for sharded clusters; and mongothe interactive MongoDB Shell.

MongoDB 包中的核心组件是:mongod- 核心数据库进程;mongos- 分片集群的控制器和查询路由器;和mongo交互式 MongoDB Shell。

For more information http://docs.mongodb.org/manual/reference/program/

有关更多信息http://docs.mongodb.org/manual/reference/program/

回答by punkrockpolly

Mongos= MongoDB Shard Utility, the controller and query router for sharded clusters. Sharding partitions the data-set into discrete parts.

Mongos= MongoDB Shard Utility,分片集群的控制器和查询路由器。分片将数据集划分为离散的部分。

Mongod= The primary daemon process for the MongoDB system. It handles data requests, manages data access, and performs background management operations.

Mongod= MongoDB 系统的主要守护进程。它处理数据请求,管理数据访问,并执行后台管理操作。

This explanation of mongo replication and sharding really helped me understand it: https://dba.stackexchange.com/a/53705/106925

mongo 复制和分片的这个解释真的帮助我理解它:https: //dba.stackexchange.com/a/53705/106925

回答by Edward

In shard clusters, mongod as a shard data process and store shard metadata process. mongos as a route process to manipulate client request.

在分片集群中,mongod 作为分片数据处理和存储分片元数据的过程。mongos 作为路由进程来操作客户端请求。