Database Manual / Self-Managed Deployments / Administration / Performance

Configure Self-Managed Sharded Cluster Health with Health Managers使用运行状况管理器配置自我管理的分片群集运行状况

This document describes how to use Health Managers to monitor and manage sharded cluster health issues.本文档描述了如何使用运行状况管理器来监视和管理分片集群的运行状况问题。

Overview概述

A Health Manager runs health checks on a health manager facet at a specified intensity level. Health Manager checks run at specified time intervals. 健康管理器以指定的强度级别对健康管理器方面运行健康检查。运行状况管理器检查以指定的时间间隔运行。A Health Manager can be configured to move a failing mongos out of a cluster automatically. 健康管理器可以配置为自动将失败的mongos移出集群。Progress Monitor ensures that Health Manager checks do not become stuck or unresponsive.进度监视器确保运行状况管理器检查不会卡住或无响应。

Health Manager Facets健康管理器方面

The following table shows the available Health Manager facets:下表显示了可用的健康管理器方面:

Facet方面What the Health Observer Checks健康观察员检查什么
configServerCluster health issues related to connectivity to the config server.与配置服务器连接相关的群集健康问题。
dnsCluster health issues related to DNS availability and functionality.与DNS可用性和功能相关的群集健康问题。
ldapCluster health issues related to LDAP availability and functionality.与LDAP可用性和功能相关的群集健康问题。

Health Manager Intensity Levels健康管理器强度级别

The following table shows the available Health Manager intensity levels:下表显示了可用的健康管理器强度级别:

Intensity Level强度水平Description描述
criticalThe Health Manager on this facet is enabled and has the ability to move the failing mongos out of the cluster if an error occurs. 此方面的健康管理器已启用,如果发生错误,它能够将失败的mongos移出集群。The Health Manager waits the amount of time specified by activeFaultDurationSecs before stopping and moving the mongos out of the cluster automatically.健康管理器会等待activeFaultDurationSecs指定的时间,然后停止并自动将mongos移出集群。
non-criticalThe Health Manager on this facet is enabled and logs errors, but the mongos remains in the cluster if errors are encountered.此方面的健康管理器已启用并记录错误,但如果遇到错误,mongos仍将留在集群中。
offThe Health Manager on this facet is disabled. The mongos does not perform any health checks on this facet. This is the default intensity level.此方面的运行状况管理器已禁用。蒙古人在这方面没有进行任何健康检查。这是默认的强度级别。

Active Fault Duration活动故障持续时间

When a failure is detected and the Health Manager intensity level is set to critical, the Health Manager waits the amount of time specified by activeFaultDurationSecs before stopping and moving the mongos out of the cluster automatically.当检测到故障并且健康管理器强度级别设置为严重时,健康管理器会等待activeFaultDurationSecs指定的时间,然后停止并自动将mongos移出集群。

Progress Monitor进度监视器

Progress Monitor runs tests to ensure that Health Manager checks do not become stuck or unresponsive. Progress Monitor runs these tests in intervals specified by interval. 进度监视器运行测试以确保运行状况管理器检查不会卡住或无响应。进度监视器以interval指定的间隔运行这些测试。If a health check begins but does not complete within the timeout given by deadline, Progress Monitor stops the mongos and removes it from the cluster.如果健康检查开始但未在deadline给定的超时内完成,进度监视器将停止mongos并将其从集群中删除。

progressMonitor Fields字段

Field字段Description描述Units
intervalHow often to ensure Health Managers are not stuck or unresponsive.多久确保一次健康管理器不会陷入困境或没有反应。Milliseconds
deadlineTimeout before automatically failing the mongos if a Health Manager check is not making progress.如果健康管理器检查没有取得进展,则自动使mongos失败之前超时。Seconds

Examples示例

The following examples show how Health Managers can be configured. For information on Health Manager parameters, see Health Manager Parameters.以下示例显示了如何配置健康管理器。有关健康管理器参数的信息,请参阅健康管理器的参数

Intensity强度

For example, to set the dns Health Manager facet to the critical intensity level, issue the following at startup:例如,要将dns健康管理器方面设置为临界强度级别,请在启动时发出以下命令:

mongos --setParameter 'healthMonitoringIntensities={ values:[ { type:"dns", intensity: "critical"} ] }'

Or if using the setParameter command in a mongosh session that is connected to a running mongos:或者,如果在连接到正在运行的mongosmongosh会话中使用setParameter命令:

db.adminCommand(
{
setParameter: 1,
healthMonitoringIntensities: { values: [ { type: "dns", intensity: "critical" } ] } } )
}
)

Parameters set with setParameter do not persist across restarts. See the setParameter page for details.使用setParameter设置的参数在重新启动后不会持续存在。有关详细信息,请参阅setParameter页面。

To make this setting persistent, set healthMonitoringIntensities in your mongos config file using the setParameter option as in the following example:要使此设置持久化,请使用setParameter选项在mongos配置文件中设置healthMonitoringIntensities,如下例所示:

setParameter:
healthMonitoringIntensities: "{ values:[ { type:\"dns\", intensity: \"critical\"} ] }"

healthMonitoringIntensities accepts an array of documents, values. Each document in values takes two fields:接受一组文档和valuesvalues中的每个文档都有两个字段:

  • type, the Health Manager facet,健康管理器方面
  • intensity, the intensity level,强度水平

See healthMonitoringIntensities for details.有关详细信息,请参阅healthMonitoringIntensities

Intervals间隔

For example, to set the ldap Health Manager facet to the run health checks every 30 seconds, issue the following at startup:例如,要将ldap健康管理器方面设置为每30秒运行一次健康检查,请在启动时发出以下命令:

mongos --setParameter 'healthMonitoringIntervals={ values:[ { type:"ldap", interval: "30000"} ] }'

Or if using the setParameter command in a mongosh session that is connected to a running mongos:或者,如果在连接到正在运行的mongosmongosh会话中使用setParameter命令:

db.adminCommand(
{
setParameter: 1,
healthMonitoringIntervals: { values: [ { type: "ldap", interval: "30000" } ] } } )
}
)

Parameters set with setParameter do not persist across restarts. See the setParameter page for details.使用setParameter设置的参数在重新启动后不会持续存在。有关详细信息,请参阅setParameter页面。

To make this setting persistent, set healthMonitoringIntervals in your mongos config file using the setParameter option as in the following example:要使此设置持久化,请使用setParameter选项在mongos配置文件中设置healthMonitoringIntervals,如下例所示:

setParameter:
healthMonitoringIntervals: "{ values: [{type: \"ldap\", interval: 200}] }"

healthMonitoringIntervals accepts an array of documents, values. Each document in values takes two fields:接受一组文档和valuesvalues中的每个文档都有两个字段:

  • type, the Health Manager facet,健康管理器方面
  • interval, the time interval it runs at, in milliseconds,它运行的时间间隔,以毫秒为单位

See healthMonitoringIntervals for details.有关详细信息,请参阅healthMonitoringIntervals

Active Fault Duration活动故障持续时间

For example, to set the duration from failure to crash to five minutes, issue the following at startup:例如,要将故障到崩溃的持续时间设置为五分钟,请在启动时发出以下命令:

mongos --setParameter activeFaultDurationSecs=300

Or if using the setParameter command in a mongosh session that is connected to a running mongos:或者,如果在连接到正在运行的mongosmongosh会话中使用setParameter命令:

db.adminCommand(
{
setParameter: 1,
activeFaultDurationSecs: 300
}
)

Parameters set with setParameter do not persist across restarts. See the setParameter page for details.使用setParameter设置的参数在重新启动后不会持续存在。有关详细信息,请参阅setParameter页面

To make this setting persistent, set activeFaultDurationSecs in your mongos config file using the setParameter option as in the following example:要使此设置持久化,请使用setParameter选项在mongos配置文件中设置activeFaultDurationSecs,如下例所示:

setParameter:
activeFaultDurationSecs: 300

See activeFaultDurationSecs for details.有关详细信息,请参阅activeFaultDurationSecs

Progress Monitor进度监视器

Progress Monitor runs tests to ensure that Health Manager checks do not become stuck or unresponsive. Progress Monitor runs these tests in intervals specified by interval. 进度监视器运行测试以确保运行状况管理器检查不会卡住或无响应。进度监视器以interval指定的间隔运行这些测试。If a health check begins but does not complete within the timeout given by deadline, Progress Monitor stops the mongos and removes it from the cluster.如果健康检查开始但未在deadline给定的超时内完成,进度监视器将停止mongos并将其从集群中删除。

To set the interval to 1000 milliseconds and the deadline to 300 seconds, issue the following at startup:要将interval设置为1000毫秒,将deadline设置为300秒,请在启动时发出以下命令:

mongos --setParameter 'progressMonitor={"interval": 1000, "deadline": 300}'

Or if using the setParameter command in a mongosh session that is connected to a running mongos:或者,如果在连接到正在运行的mongosmongosh会话中使用setParameter命令:

db.adminCommand(
{
setParameter: 1,
progressMonitor: { interval: 1000, deadline: 300 } )
}
)

Parameters set with setParameter do not persist across restarts. See the setParameter page for details.使用setParameter设置的参数在重新启动后不会持续存在。有关详细信息,请参阅setParameter页面

To make this setting persistent, set progressMonitor in your mongos config file using the setParameter option as in the following example:要使此设置持久化,请使用setParameter选项在mongos配置文件中设置progressMonitor,如下例所示:

setParameter:
progressMonitor: "{ interval: 1000, deadline: 300 }"

See progressMonitor for details.有关详细信息,请参阅progressMonitor