Database Manual / Reference / Database Commands / Diagnostics

hostInfo (database command数据库命令)

Definition定义

hostInfo
Returns:返回A document with information about the underlying system that the mongod or mongos runs on. Some of the returned fields are only included on some platforms.一个文档,其中包含有关mongodmongos运行的底层系统的信息。一些返回的字段仅包含在某些平台上。

You must run the hostInfo command, which takes no arguments, against the admin database.您必须对管理数据库运行不带参数的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输出字段

hostInfo
The document returned by the hostInfo.hostInfo返回的文档。
hostInfo.system
An embedded document providing information about the underlying environment of the system running the mongod or mongos一个嵌入式文档,提供有关运行mongodmongos的系统底层环境的信息
hostInfo.system.currentTime
A timestamp of the current system time.当前系统时间的时间戳。
hostInfo.system.hostname
The system name, which should correspond to the output of hostname -f on Linux systems.系统名称,应与Linux系统上的hostname -f的输出相对应。
hostInfo.system.cpuAddrSize
A number reflecting the architecture of the system. Either 32 or 64.反映系统架构的数字。3264
hostInfo.system.memSizeMB
The total amount of system memory (RAM) in megabytes.系统内存(RAM)的总量,单位为兆字节。
hostInfo.system.memLimitMB

The 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.numCores
The total number of available logical processor cores.可用逻辑处理器核心的总数。
hostInfo.system.numCoresAvailableToProcess
The number of CPU cores available to the process. Returns -1 when the underlying system call to retrieve the number of cores fails.进程可用的CPU核数。当检索核心数量的底层系统调用失败时,返回-1
hostInfo.system.cpuArch
A string that represents the system architecture. Either x86 or x86_64.表示系统架构的字符串。x86x86_64
hostInfo.system.numaEnabled
A boolean value. false if NUMA is interleaved (i.e. disabled), otherwise true.一个布尔值。如果NUMA是交错的(即禁用),则为false,否则为true
hostInfo.os
An embedded document that contains information about the operating system running the mongod and mongos.一个嵌入式文档,其中包含有关运行mongodmongos的操作系统的信息。
hostInfo.os.type
A string representing the type of operating system, such as Linux or Windows.表示操作系统类型的字符串,如LinuxWindows
hostInfo.os.name
If available, returns a display name for the operating system.如果可用,则返回操作系统的显示名称。
hostInfo.os.version
If available, returns the name of the distribution or operating system.如果可用,则返回发行版或操作系统的名称。
hostInfo.extra
An embedded document with extra information about the operating system and the underlying hardware. The content of the extra embedded document depends on the operating system.包含有关操作系统和底层硬件的额外信息的嵌入式文档。extra嵌入文档的内容取决于操作系统。
hostInfo.extra.cpuString

A string containing a human-readable description of the system's processor.包含系统处理器的人类可读描述的字符串。

cpuString only appears on macOS systems.仅在macOS系统上显示。

hostInfo.extra.versionString
A complete string of the operating system version and identification. On Linux and macOS systems, this contains output similar to uname -a.操作系统版本和标识的完整字符串。在Linux和macOS系统上,这包含类似于uname -a的输出。
hostInfo.extra.libcVersion

The release of the system libc.系统libc的发布。

libcVersion only appears on Linux systems.仅出现在Linux系统上。

hostInfo.extra.kernelVersion

The release of the Linux kernel in current use.当前使用的Linux内核的发布。

kernelVersion only appears on Linux systems.仅出现在Linux系统上。

hostInfo.extra.alwaysFullSync
alwaysFullSync only appears on macOS systems.仅在macOS系统上显示。
hostInfo.extra.nfsAsync
nfsAsync only appears on macOS systems.仅在macOS系统上显示。
hostInfo.extra.cpuFrequencyMHz
Reports the clock speed of the system's processor in megahertz.报告系统处理器的时钟速度,单位为兆赫。
hostInfo.extra.cpuFeatures
Reports the processor feature flags. On Linux systems this the same information that /proc/cpuinfo includes in the flags fields.报告处理器功能flags。在Linux系统上,这与/proc/cpuinfo在标志字段中包含的信息相同。
hostInfo.extra.pageSize
Reports the default system page size in bytes.报告默认系统页面大小(以字节为单位)。
hostInfo.extra.physicalCores

Reports the number of physical, non-HyperThreading, cores available on the system.报告系统上可用的物理非超线程内核的数量。

physicalCores only appears on macOS systems.仅在macOS系统上显示。

hostInfo.extra.numPages
numPages only appears on Linux systems.仅出现在Linux系统上。
hostInfo.extra.maxOpenFiles

Reports the current system limits on open file handles. See UNIX ulimit Settings for Self-Managed Deployments for more information.报告当前系统对打开文件句柄的限制。有关详细信息,请参阅用于自我管理部署的UNIX ulimit设置

maxOpenFiles only appears on Linux systems.仅出现在Linux系统上。

hostInfo.extra.scheduler
Reports the active I/O scheduler. scheduler only appears on OS X systems.报告活动I/O调度程序。scheduler仅出现在OS X系统上。