对于 AI 代理:可在 https://www.mongodb.com/zh-cn/docs/llms.txt 获取文档索引—通过在任何 URL 路径后添加 .md 可获取所有页面的 Markdown 版本。
Docs 菜单

hostInfo(数据库命令)

hostInfo
返回:

一个文档,其中包含运行 mongod 或 mongos 的底层系统的相关信息。某些返回的字段仅包含在某些平台上。

You must run the hostInfo command, which takes no arguments, against the admin database.

此命令可用于以下环境中托管的部署:

  • 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.

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>
}
hostInfo

The document returned by the hostInfo.

hostInfo.system

嵌入式文档;提供有关运行 mongod 或 mongos 的系统的底层环境的信息。

hostInfo.system.currentTime

当前系统时间的时间戳。

hostInfo.system.hostname

系统名称;应与 Linux 系统上的 hostname -f 的输出相对应。

hostInfo.system.cpuAddrSize

反映系统架构的数字。32 或 64。

hostInfo.system.memSizeMB

系统内存 (RAM) 总量(以 MB 为单位)。

hostInfo.system.memLimitMB

内存使用限制(以 MB 为单位)。

例如,在容器中运行可能会施加低于总系统内存的内存限制。该内存限制(而不是总系统内存)作为可用于计算 WiredTiger 内部缓存的最大 RAM。

hostInfo.system.numCores

可用逻辑处理器核心的总数。

hostInfo.system.numCoresAvailableToProcess

进程可用的 CPU 核心数。 当检索内核数的根本的系统调用失败时,返回 -1。

hostInfo.system.cpuArch

表示系统架构的字符串。x86 或 x86_64。

hostInfo.system.numaEnabled

一个布尔值。 false 如果 NUMA 是交错的(即 已禁用),否则为true 。

hostInfo.os

嵌入式文档;包含有关运行 mongod 和 mongos 的操作系统的信息。

hostInfo.os.type

表示操作系统类型的字符串,例如 Linux 或 Windows。

hostInfo.os.name

如果可用,则返回操作系统的显示名称。

hostInfo.os.version

如果可用,则返回发行版或操作系统名称。

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.

hostInfo.extra.cpuString

包含系统处理器的人类可读描述的字符串。

cpuString 仅显示在 macOS 系统上。

hostInfo.extra.versionString

操作系统版本和标识的完整字符串。在 Linux 和 macOS 系统上,它包含类似于 uname -a 的输出。

hostInfo.extra.libcVersion

系统 libc 的版本。

libcVersion 仅出现在 Linux 系统上。

hostInfo.extra.kernelVersion

当前使用的 Linux 内核的版本。

kernelVersion 仅出现在 Linux 系统上。

hostInfo.extra.alwaysFullSync

alwaysFullSync 仅显示在 macOS 系统上。

hostInfo.extra.nfsAsync

nfsAsync 仅显示在 macOS 系统上。

hostInfo.extra.cpuFrequencyMHz

报告系统处理器的时钟速度(以兆赫为单位)。

hostInfo.extra.cpuFeatures

报告处理器功能标记。在 Linux 系统上,它与 /proc/cpuinfo 在 flags 字段中包含的信息相同。

hostInfo.extra.pageSize

报告默认系统页面大小(以字节为单位)。

hostInfo.extra.physicalCores

报告系统上的可用物理非超线程核心数。

physicalCores 仅显示在 macOS 系统上。

hostInfo.extra.numPages

numPages 仅出现在 Linux 系统上。

hostInfo.extra.maxOpenFiles

报告有关打开文件处理的当前系统限制。有关详细信息,请参阅 自管理部署的 UNIX ulimit 设置。

maxOpenFiles 仅出现在 Linux 系统上。

hostInfo.extra.scheduler

Reports the active I/O scheduler. scheduler only appears on OS X systems.

给本页内容打分