Definition定义
hostInfo-
Returns:返回A document with information about the underlying system that the一个文档,其中包含有关mongodormongosruns on. Some of the returned fields are only included on some platforms.mongod或mongos运行的底层系统的信息。一些返回的字段仅包含在某些平台上。You must run the您必须对管理数据库运行不带参数的hostInfocommand, which takes no arguments, against theadmindatabase.hostInfo命令。
Compatibility兼容性
This command is available in deployments hosted in the following environments:此命令在以下环境中托管的部署中可用:
- MongoDB Atlas
: The fully managed service for MongoDB deployments in the cloud:云中MongoDB部署的完全托管服务
Important
This command is not supported in M0 and Flex clusters. For more information, see Unsupported Commands.M0和Flex集群不支持此命令。有关详细信息,请参阅不支持的命令。
- MongoDB Enterprise
: The subscription-based, self-managed version of MongoDB:MongoDB的基于订阅的自我管理版本 - MongoDB Community
: The source-available, free-to-use, and self-managed version of MongoDB:MongoDB的源代码可用、免费使用和自我管理版本
Syntax语法
db.adminCommand(
{
hostInfo: 1
}
)Output输出
In 在mongosh you can use db.hostInfo() as a helper to access hostInfo. The output of hostInfo on a Linux system will resemble the following:mongosh中,您可以使用db.hostInfo()作为助手来访问hostInfo。Linux系统上hostInfo的输出类似于以下内容:
{
"system" : {
"currentTime" : ISODate("<timestamp>"),
"hostname" : "<hostname>",
"cpuAddrSize" : <number>,
"memSizeMB" : <number>,
"memLimitMB" : <number>,
"numCores" : <number>,
"numCoresAvailableToProcess" : <number>,
"cpuArch" : "<identifier>",
"numaEnabled" : <boolean>
},
"os" : {
"type" : "<string>",
"name" : "<string>",
"version" : "<string>"
},
"extra" : {
"versionString" : "<string>",
"libcVersion" : "<string>",
"kernelVersion" : "<string>",
"cpuFrequencyMHz" : "<string>",
"cpuFeatures" : "<string>",
"pageSize" : <number>,
"numPages" : <number>,
"maxOpenFiles" : <number>
},
"ok" : <return>
}
Output Fields输出字段
hostInfoThe document returned by thehostInfo.hostInfo返回的文档。
hostInfo.systemAn embedded document providing information about the underlying environment of the system running the一个嵌入式文档,提供有关运行mongodormongosmongod或mongos的系统底层环境的信息
hostInfo.system.currentTimeA timestamp of the current system time.当前系统时间的时间戳。
hostInfo.system.hostnameThe system name, which should correspond to the output of系统名称,应与Linux系统上的hostname -fon Linux systems.hostname -f的输出相对应。
hostInfo.system.cpuAddrSizeA number reflecting the architecture of the system. Either反映系统架构的数字。32or64.32或64。
hostInfo.system.memSizeMBThe total amount of system memory (RAM) in megabytes.系统内存(RAM)的总量,单位为兆字节。
hostInfo.system.memLimitMBThe memory usage limit in megabytes.内存使用限制(MB)。For example, running in a container may impose memory limits that are lower than the total system memory. This memory limit, rather than the total system memory, is used as the maximum RAM available to calculate WiredTiger internal cache.例如,在容器中运行可能会施加低于总系统内存的内存限制。此内存限制,而不是总系统内存,被用作计算WiredTiger内部缓存的最大可用RAM。
hostInfo.system.numCoresThe total number of available logical processor cores.可用逻辑处理器核心的总数。
hostInfo.system.numCoresAvailableToProcessThe number of CPU cores available to the process. Returns进程可用的CPU核数。当检索核心数量的底层系统调用失败时,返回-1when the underlying system call to retrieve the number of cores fails.-1。
hostInfo.system.cpuArchA string that represents the system architecture. Either表示系统架构的字符串。x86orx86_64.x86或x86_64。
hostInfo.system.numaEnabledA boolean value.一个布尔值。如果NUMA是交错的(即禁用),则为falseif NUMA is interleaved (i.e. disabled), otherwisetrue.false,否则为true。
hostInfo.osAn embedded document that contains information about the operating system running the一个嵌入式文档,其中包含有关运行mongodandmongos.mongod和mongos的操作系统的信息。
hostInfo.os.typeA string representing the type of operating system, such as表示操作系统类型的字符串,如LinuxorWindows.Linux或Windows。
hostInfo.os.nameIf available, returns a display name for the operating system.如果可用,则返回操作系统的显示名称。
hostInfo.os.versionIf available, returns the name of the distribution or operating system.如果可用,则返回发行版或操作系统的名称。
hostInfo.extraAn embedded document with extra information about the operating system and the underlying hardware. The content of the包含有关操作系统和底层硬件的额外信息的嵌入式文档。extraembedded document depends on the operating system.extra嵌入文档的内容取决于操作系统。
hostInfo.extra.cpuStringA string containing a human-readable description of the system's processor.包含系统处理器的人类可读描述的字符串。cpuStringonly appears on macOS systems.仅在macOS系统上显示。
hostInfo.extra.versionStringA complete string of the operating system version and identification. On Linux and macOS systems, this contains output similar to操作系统版本和标识的完整字符串。在Linux和macOS系统上,这包含类似于uname -a.uname -a的输出。
hostInfo.extra.libcVersionThe release of the system系统libc.libc的发布。libcVersiononly appears on Linux systems.仅出现在Linux系统上。
hostInfo.extra.kernelVersionThe release of the Linux kernel in current use.当前使用的Linux内核的发布。kernelVersiononly appears on Linux systems.仅出现在Linux系统上。
hostInfo.extra.alwaysFullSyncalwaysFullSynconly appears on macOS systems.仅在macOS系统上显示。
hostInfo.extra.nfsAsyncnfsAsynconly appears on macOS systems.仅在macOS系统上显示。
hostInfo.extra.cpuFrequencyMHzReports the clock speed of the system's processor in megahertz.报告系统处理器的时钟速度,单位为兆赫。
hostInfo.extra.cpuFeaturesReports the processor feature flags. On Linux systems this the same information that报告处理器功能/proc/cpuinfoincludes in theflagsfields.flags。在Linux系统上,这与/proc/cpuinfo在标志字段中包含的信息相同。
hostInfo.extra.pageSizeReports the default system page size in bytes.报告默认系统页面大小(以字节为单位)。
hostInfo.extra.physicalCoresReports the number of physical, non-HyperThreading, cores available on the system.报告系统上可用的物理非超线程内核的数量。physicalCoresonly appears on macOS systems.仅在macOS系统上显示。
hostInfo.extra.numPagesnumPagesonly appears on Linux systems.仅出现在Linux系统上。
hostInfo.extra.maxOpenFilesReports the current system limits on open file handles. See UNIX报告当前系统对打开文件句柄的限制。有关详细信息,请参阅用于自我管理部署的UNIXulimitSettings for Self-Managed Deployments for more information.ulimit设置。maxOpenFilesonly appears on Linux systems.仅出现在Linux系统上。
hostInfo.extra.schedulerReports the active I/O scheduler.报告活动I/O调度程序。scheduleronly appears on OS X systems.scheduler仅出现在OS X系统上。