定义
兼容性
此命令可用于以下环境中托管的部署:
- MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud
重要
This command is not supported in M0 and Flex clusters. For more information, see Unsupported Commands.
MongoDB Enterprise:基于订阅、自我管理的 MongoDB 版本
MongoDB Community:源代码可用、免费使用且可自行管理的 MongoDB 版本
语法
db.adminCommand( { hostInfo: 1 } )
输出
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:
{ "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> }
输出字段
hostInfoThe document returned by the
hostInfo.
hostInfo.system.memLimitMB内存使用限制(以 MB 为单位)。
例如,在容器中运行可能会施加低于总系统内存的内存限制。该内存限制(而不是总系统内存)作为可用于计算 WiredTiger 内部缓存的最大 RAM。
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.
hostInfo.extra.cpuString包含系统处理器的人类可读描述的字符串。
cpuString仅显示在 macOS 系统上。
hostInfo.extra.libcVersion系统
libc的版本。libcVersion仅出现在 Linux 系统上。
hostInfo.extra.kernelVersion当前使用的 Linux 内核的版本。
kernelVersion仅出现在 Linux 系统上。
hostInfo.extra.alwaysFullSyncalwaysFullSync仅显示在 macOS 系统上。
hostInfo.extra.nfsAsyncnfsAsync仅显示在 macOS 系统上。
hostInfo.extra.physicalCores报告系统上的可用物理非超线程核心数。
physicalCores仅显示在 macOS 系统上。
hostInfo.extra.numPagesnumPages仅出现在 Linux 系统上。
hostInfo.extra.maxOpenFiles报告有关打开文件处理的当前系统限制。有关详细信息,请参阅 自管理部署的 UNIX ulimit 设置。
maxOpenFiles仅出现在 Linux 系统上。
hostInfo.extra.schedulerReports the active I/O scheduler.
scheduleronly appears on OS X systems.