注意
群组和项目是同义术语。 您的 {PROJECT-ID} 与您的群组 ID(group ID)相同。对于现有群组,您的群组/项目 ID 保持不变。当引用说明时,此页面使用更为人熟知的术语“群组”。终结点保持不变,如文档中所述。
本页介绍构成自动化配置的参数。
要查看其他示例,请参阅 mms-api-examples。
配置版本
这会列出自动化配置的版本。
"version" : "<integer>"
名称 | 类型 | 必要性 | 说明 |
|---|---|---|---|
版本 | 整型 | 必需 | 此自动化配置文件的修订版。 |
下载库
Cloud Manager 下载自动版本,并在设定的目录options.downloadBase中运行启动脚本。
"options" : { "downloadBase" : "<string>", }
名称 | 类型 | 必要性 | 说明 |
|---|---|---|---|
选项 | 对象 | 必需 | 自动下载新版本的路径。 |
options.downloadBase | 字符串 | 必需 | Linux 和 UNIX 平台上用于自动版本下载和初创企业脚本的目录。 |
MongoDB 版本规范
mongoDbVersions[n]数组定义了在processes数组中找到的 MongoDB 实例的规范对象。 processes数组中的每个 MongoDB 实例都必须在该数组中具有规范对象。
1 "mongoDbVersions[n]" : [ 2 { 3 "name" : "<string>", 4 "builds" : [ 5 { 6 "platform" : "<string>", 7 "url" : "<string>", 8 "gitVersion" : "<string>", 9 "modules" : [ "<string>", ... ], 10 "architecture" : "<string>", 11 "bits" : "<integer>", 12 "win2008plus" : "<Boolean>", 13 "winVCRedistUrl" : "<string>", 14 "winVCRedistOptions" : [ "<string>", ... ], 15 "winVCRedistDll" : "<string>", 16 "winVCRedistVersion" : "<string>" 17 }, 18 ... 19 ], 20 }, 21 ... 22 ]
名称 | 类型 | 必要性 | 说明 |
|---|---|---|---|
mongoDbVersions[n] | 对象数组 | 必需 | 在进程数组中找到的 MongoDB 实例的规范对象。 进程中的每个 MongoDB 实例都必须在mongoDbVersions[n]中具有规范对象。 |
mongoDbVersions[n].name | 字符串 | 必需 | 规范对象的名称。 在此配置中,规范对象通过实例的processes.version参数附加到 MongoDB 实例。 |
mongoDbVersions[n].builds[k] | 对象数组 | 必需 | 此 MongoDB 实例可用的版本。 |
mongoDbVersions[n].builds[k].platform | 字符串 | 必需 | 此 MongoDB 实例的平台。 |
mongoDbVersions[n].builds[k].url | 字符串 | 必需 | 为此实例下载 MongoDB 的URL 。 |
mongoDbVersions[n].builds[k].gitVersion | 字符串 | 必需 | Commit identifier that identifies the state of the code used to build the MongoDB process. The MongoDB |
mongoDbVersions[n].builds[k].modules | 阵列 | 必需 | 此版本的模块列表。 对应于buildInfo命令返回的模块参数。 |
mongoDbVersions[n].builds[k].architecture | 字符串 | 必需 | 处理器的架构。 Cloud Manager 接受amd64或ppc64le 。 |
mongoDbVersions[n].builds[k].bits | 整型 | 已弃用 | 处理器的总线宽度。 请勿删除或修改此参数。 |
mongoDbVersions[n].builds[k].win2008plus | 布尔 | Optional | 如果这是需要 Windows 7 更高版本或 Windows 服务器 2008 R2 或更高版本的 Windows 版本,则设置为true 。 |
mongoDbVersions[n].builds[k].winVCRedistUrl | 字符串 | Optional | 可从其中下载所需版本的 Microsoft Visual C++ 可再发行组件的URL 。 |
mongoDbVersions[n].builds[k].winVCRedistOptions | 字符串数组 | Optional | 列出运行 Microsoft Visual C++ 可再发行组件安装程序时要指定的命令行选项的字符串值。 每个命令行选项都是数组中的一个单独字符串。 |
mongoDbVersions[n].builds[k].winVCRedistDll | 字符串 | Optional | Microsoft Visual C# 运行时 DLL 文件的名称,代理会检查该文件以确定是否需要新版本的 Microsoft Visual C# 可再发行组件。 |
mongoDbVersions[n].builds[k].winVCRedistVersion | 字符串 | Optional | 要跳过 Microsoft Visual C++ 可再发行组件的安装,必须提供 Microsoft Visual C++ 运行时 DLL 的最低版本。 |
自动化
agentVersion指定 MongoDB Agent 的版本。
注意
虽然您可以通过此配置属性更新 MongoDB Agent,但应使用更新 Agent 版本端点来确保您的版本是最新的。
"agentVersion" : { "name" : "<string>", "directoryUrl" : "<string>" }
名称 | 类型 | 必要性 | 说明 |
|---|---|---|---|
AgentVersion | 对象 | Optional | 要运行的 MongoDB Agent 的版本。如果运行版本与此设置不匹配,MongoDB Agent会下载指定版本,自行关闭,然后启动新版本。 |
AgentVersion.name | 字符串 | Optional | 所需的 MongoDB Agent 版本。 |
AgentVersion.directoryUrl | 字符串 | Optional | 用于下载 MongoDB Agent 的URL 。 |
MongoDB 进程
进程数组决定了 MongoDB 实例的配置。 使用此数组,您可以:
恢复实例。
在一个或多个 MongoDB 实例上启动初始同步进程。
1 "processes": [{ 2 "<args>": {}, 3 "alias": "<string>", 4 "authSchemaVersion": "<integer>", 5 "backupRestoreUrl": "<string>", 6 "cluster": "<string>", 7 "defaultRWConcern": { 8 "defaultReadConcern": { 9 "level": "<string>" 10 }, 11 "defaultWriteConcern": { 12 "j": "<boolean>", 13 "w": "<string>", 14 "wtimeout": "<integer>" 15 } 16 } 17 "disabled": "<Boolean>", 18 "featureCompatibilityVersion": "<string>", 19 "hostname": "<string>", 20 "lastCompact" : "<dateInIso8601Format>", 21 "lastRestart" : "<dateInIso8601Format>", 22 "lastResync" : "<dateInIso8601Format>", 23 "lastKmipMasterKeyRotation" : "<dateInIso8601Format>", 24 "logRotate": { 25 "sizeThresholdMB": "<number>", 26 "timeThresholdHrs": "<integer>", 27 "numUncompressed": "<integer>", 28 "percentOfDiskspace": "<number>", 29 "numTotal": "<integer>" 30 }, 31 "manualMode": "<Boolean>", 32 "name": "<string>", 33 "numCores": "<integer>", 34 "processType": "<string>", 35 "version": "<string>" 36 }]
名称 | 类型 | 必要性 | 说明 |
|---|---|---|---|
processes | 阵列 | 必需 | |
processes[n].args2_6 | 对象 | 必需 | MongoDB 2.6 及更高版本的 MongoDB 配置对象。
|
processes[n].alias | 字符串 | Optional | 运行进程的主机的主机名别名(通常是DNS CNAME)。 如果指定了别名,则在连接到主机时,MongoDB Agent会优先使用此别名,而不是在processes.hostname中指定的主机名。您还可以在replicaSets.host和sharding.configServer中指定此别名。 |
processes[n].authSchemaVersion | 整型 | 必需 | MongoDB 数据库用户的用户档案的模式版本。 这应该与进程数组中属于同一集群的所有其他元素匹配。
|
processes[n].backupRestoreUrl | 字符串 | Optional | Delivery URL for the restore. Cloud Manager sets this when creating a restore. To cancel an in-progress restore operation, set this option to 要学习;了解更多信息,请参阅通过API自动执行备份恢复。 |
processes[n].cluster | 字符串 | 可选的 | |
defaultRWConcern.defaultReadConcern.level | 字符串 | Optional | 为从副本集和副本集分片读取的数据设置的一致性和隔离性属性。 MongoDB Atlas 接受以下值:
|
defaultRWConcern.defaultWriteConcern.j | 布尔 | Optional | 指示写入确认是否必须写入磁盘日志的标志。 |
defaultRWConcern.defaultWriteConcern.w | 字符串 | Optional | 必须确认副本集和副本集分片中的写入操作的 mongod 实例的所需数量。 MongoDB Atlas 接受以下值:
|
defaultRWConcern.defaultWriteConcern.wtimeout | 数字 | Optional | 写关注(write concern)的所需时间限制(以毫秒为单位)。当您将 defaultRWConcern.defaultWriteConcern.w设立为大于 1的值时,请设置此值。 |
processes[n].disabled | 布尔 | Optional | 指示是否应关闭此进程的标志。 设置为true可关闭进程。 |
processes[n].featureCompatibilityVersion | 字符串 | 必需 | 与此进程具有功能兼容性的 MongoDB 版本。 更改此值可以启用或禁用某些功能,这些功能会保留与早于或晚于您选择的featureCompatibilityVersion的 MongoDB 版本不兼容的数据。
To learn more, see |
processes[n].hostname | 字符串 | 必需 | 为该进程提供服务的主机名称。 默认为localhost 。 |
processes[n].lastCompact | 字符串 | Optional | Cloud Manager上次回收集群磁盘上的可用空间时的 ISO 8601 日期和时间格式的时间戳(以 UTC 为单位)。在某些操作过程中, MongoDB可能会移动或删除数据,但不会释放当前未使用的空间。 Cloud Manager以滚动方式在副本集或分片的成员之间回收磁盘空间。 要回收此空间,请执行以下操作: 为删除对何时回收集群磁盘空间的歧义,请指定带有 ISO8601 时间戳的时区域。示例,要将 processes.lastCompact设立为 2820212143 月::52 PM 美国中部标准时间,请使用 |
processes[n].lastRestart | 字符串 | Optional | Cloud Manager上次重新启动此进程时采用 ISO 8601 日期和时间格式(UTC 时间)的时间戳。如果将此参数设立为当前时间戳,则在您上传此配置后, Cloud Manager会强制重新启动此进程。如果为同一集群中的多个进程设立此参数, Cloud Manager将以滚动方式跨副本集或分片的成员重新启动所选进程。 |
processes[n].lastResync | 字符串 | Optional | Cloud Manager在节点上执行的上次初始同步进程的 ISO8601 日期和时间格式(UTC 格式)的时间戳。 要立即触发节点上的初始化同步进程,请将此值设立为当前时间作为 ISO8601 时间戳。 WARNING: Use this parameter with caution. During initial sync, Automation removes the entire contents of the node's 如果设置此参数:
要学习;了解更多信息,请参阅初始同步。 |
processes[n].lastKmipMasterKeyRotation | 字符串 | Optional | Cloud Manager上次轮换主 KMIP 密钥时的 ISO 8601 日期和时间格式的时间戳(以 UTC 为单位)。如果将此参数设立为当前时间戳, Cloud Manager会在您上传此配置后轮换密钥。 |
processes[n].logRotate | 对象 | Optional | 用于轮换进程的 MongoDB 日志的 MongoDB 配置对象。 |
processes[n].logRotate。 numTotal | 整型 | Optional | Cloud Manager 保留的日志文件总数。如果不设置此值,则日志文件总数默认为0 。 Cloud Manager 根据其他进程进行轮换。logRotate 设置。 |
processes[n].logRotate。 numUncompressed | 整型 | Optional | 保持未压缩状态的日志文件总数的最大数量,包括当前日志文件。 默认值为5 。 |
processes[n].logRotate。 PercentOfDiskspace | 数字 | Optional | Cloud Manager 可用于存储日志文件的总磁盘空间的最大百分比,以十进制表示。如果超过此限制,Cloud Manager 将删除压缩日志文件,直到达到此限制为止。Cloud Manager 首先删除最早的日志文件。 默认值为0.02 。 |
processes[n].logRotate。 sizeThresholdMB | 数字 | 必需 | Cloud Manager 轮换日志文件之前,该文件的最大大小(以 MB 为单位)。如果日志文件达到sizeThresholdMB或processes.logRotate.timeThresholdHrs中给定的值,Cloud Manager 会立即轮换日志文件限制。 |
processes[n].logRotate。 timeThresholdHrs | 整型 | 必需 | 下次轮换之前单个日志文件的最大持续时间(以小时为单位)。 自上次轮换以来的时间。 一旦日志文件达到timeThresholdHrs或processes.logRotate.sizeThresholdMB ,Cloud Manager 就会轮换日志文件限制。 |
processes[n].manualMode | 布尔 | Optional | 指示 MongoDB Agent 是否自动执行此过程的标志。
|
processes[n].name | 字符串 | 必需 | 用于标识实例的唯一名称。 |
processes[n].numCores | 整型 | Optional | Cloud Manager 应绑定到此进程的内核数。MongoDB Agent尽可能在各个核心之间均匀地分配进程。 |
processes[n].processType | 字符串 | 必需 | |
processes[n].version | 字符串 | 必需 | 用于此实例的mongoDbVersions规范的名称。 |
集群范围
clusterWideConfigurations指定要在副本集或分片集群中设置的参数,而无需滚动重启。
1 "clusterWideConfigurations" : { 2 "<replicaSetID/clusterName>": { 3 "changeStreamOptions": { 4 "preAndPostImages": { 5 "expireAfterSeconds": <integer> 6 } 7 } 8 } 9 }
名称 | 类型 | 必要性 | 说明 |
|---|---|---|---|
replicaSetID/clusterName | 对象 | Optional | 要应用于副本集或分片集群的change stream选项。MongoDB Agent仅检查此配置是否采用有效的JSON格式,但不检查值的正确性。 |
changeStreamOptions.preAndPostImages.expireAfterSeconds | 数字 | 必需 | change stream前后映像的保留策略(以秒为单位)。如果省略该值,则集群将保留帖子和后映像,直到从 oplog 中删除相应的change stream事件。 如果删除此值,MongoDB Agent只会从其自动化配置中删除此参数,而不会从服务器中删除。 To learn more, see |
副本集
replicaSets数组定义了每个副本集的配置。 对于具有副本集的部署,此字段为必填项。
1 "replicaSets": 2 [ 3 { 4 "_id": "<string>", 5 "protocolVersion": "<string>", 6 "members": 7 [ 8 { 9 "_id": "<integer>", 10 "host": "<string>", 11 "arbiterOnly": "<boolean>", 12 "buildIndexes": "<boolean>", 13 "hidden": "<boolean>", 14 "priority": "<number>", 15 "tags": "<object>", 16 "secondaryDelaySecs": "<integer>", 17 "votes": "<number>" 18 },{ 19 "_id": "<integer>", 20 "host": "<string>", 21 "arbiterOnly": "<boolean>", 22 "buildIndexes": "<boolean>", 23 "hidden": "<boolean>", 24 "priority": "<number>", 25 "tags": "<object>", 26 "secondaryDelaySecs": "<integer>", 27 "votes": "<number>" 28 },{ 29 "_id": "<integer>", 30 "host": "<string>", 31 "arbiterOnly": "<boolean>", 32 "buildIndexes": "<boolean>", 33 "hidden": "<boolean>", 34 "priority": "<number>", 35 "tags": "<object>", 36 "secondaryDelaySecs": "<integer>", 37 "votes": "<number>" 38 } 39 ], 40 "force": 41 { 42 "currentVersion": "<integer>" 43 } 44 } 45 ]
名称 | 类型 | 必要性 | 说明 |
|---|---|---|---|
副本集 | 阵列 | Optional | 每个副本集的配置。 MongoDB Agent使用此数组中的值创建有效的副本集配置文档。 该代理会定期检查副本集是否配置正确。 如果出现问题,代理会根据其配置文档重新配置副本集。 该数组可以包含副本集配置文档中的以下顶级字段: _id ;版本;和成员。 To learn more, see |
replicaSets[n]._id | 字符串 | 必需 | 副本集的名称。 |
replicaSets[n].protocolVersion | 字符串 | Optional | 副本集的协议版本。 |
replicaSets[n].members | 阵列 | Optional | 定义副本集每个成员的对象。 members.host字段必须指定主机 To learn more, see |
replicaSets[n].members[m]._id | 整型 | 必需 | 指示副本集节点的任何正整数。 |
replicaSets[n].members[m].host | 字符串 | Optional | 为该副本集成员提供服务的主机名和端口号(如适用)。 |
replicaSets[n].members[m].arbiterOnly | 布尔 | Optional | 指示此副本集节点是否充当仲裁节点的标志。 |
replicaSets[n].members[m].buildIndexes | 布尔 | Optional | Flag that indicates whether the |
replicaSets[n].members[m].hidden | 布尔 | Optional | 指示副本集是否允许该成员接受读操作的标志。 |
replicaSets[n].members[m].优先级 | 数字 | Optional | Cloud Manager选择此副本集成员作为主要的相对资格。数量增加资格增加。 对于数据承载节点,该值可以介于 0 到 1000(含)之间。仲裁节点的值可以是 0 或 1。 |
replicaSets[n].members[m].tags | 对象 | Optional | 应用于此副本集节点的用户定义标签及其值的列表。 |
replicaSets[n].members[m].secondaryDelaySecs | 整型 | Optional | 此副本集节点应滞后于主节点的时间量(以秒为单位)。 |
replicaSets[n].members[m].votes | 数字 | Optional | 该副本集成员可以为副本集选举投票的投票数量。 所有数据承载节点都可以有 0 或 1 票。 仲裁节点始终拥有 1 票投票权。 |
replicaSets[n].force | 对象 | Optional | Instructions to the MongoDB Agent to force a replica set to use the Configuration Version specified in replicaSets.force.CurrentVersion. 通过此对象,MongoDB Agent可以强制副本集接受新配置,以便从少数成员可用的状态中恢复。 |
replicaSets[n].force.currentVersion | 整型 | Optional | MongoDB 助手强制副本集使用的配置版本。设置为 - 1可强制副本集接受新配置。 警告:强制重新配置副本集可能会导致多数提交写入操作回滚。 请谨慎操作。如果您对此操作的潜在影响有任何疑问,请联系 MongoDB 支持团队。 |
分片集群
分片数组定义了每个分片集群的配置。 对于具有分片集群的部署,此参数是必需的。
1 "sharding" : [ 2 { 3 "managedSharding" : <boolean>, 4 "name" : "<string>", 5 "configServerReplica" : "<string>", 6 "collections" : [ 7 { 8 "_id" : "<string>", 9 "key" : [ 10 [ "shard key" ], 11 [ "shard key" ], 12 ... 13 ], 14 "unique" : <boolean> 15 }, 16 ... 17 ], 18 "shards" : [ 19 { 20 "_id" : "<string>", 21 "rs" : "<string>", 22 "tags" : [ "<string>", ... ] 23 }, 24 ... 25 ], 26 "tags" : [ 27 { 28 "ns" : "<string>", 29 "min" : [ 30 { 31 "parameter" : "<string>", 32 "parameterType" : "<string>", 33 "value" : "<string>" 34 } 35 ], 36 "max" : [ 37 { 38 "parameter" : "<string>", 39 "parameterType" : "<string>", 40 "value" : "<string>" 41 } 42 ], 43 "tag" : "<string>" 44 }, 45 ... 46 ] 47 }, 48 ... 49 ]
名称 | 类型 | 必要性 | 说明 | |||||
|---|---|---|---|---|---|---|---|---|
分片 | 对象数组 | Optional | 定义每个分片集群配置的对象。 数组中的每个对象都包含一个集群的规范。 MongoDB Agent会根据规范定期检查每个集群的状态。 如果规范和集群不匹配,代理将更改集群的配置,这可能会导致负载均衡器迁移数据段。 | |||||
sharding.managedSharding | 布尔 | 可选的 | ||||||
sharding.name | 字符串 | 可选的 | Name of the cluster. This must correspond with the value in processes.cluster for a | |||||
sharding.configServerReplica | 字符串 | 可选的 | Name of the config server replica set. 如果您的配置服务器作为副本集运行,则可以添加此数组参数。 如果运行不作为副本集运行的旧版镜像配置服务器,请使用sharding.configServer 。 | |||||
sharding.configServer | 字符串数组 | 可选的 | 配置服务器主机的名称。 主机名称与每个主机的processes.name参数中使用的名称匹配。 重要提示: MongoDB 3.4已删除对镜像配置服务器的支持。 如果您的分片分片集群运行的是MongoDB 3.4或更高版本,请使用分片。 | |||||
sharding.collections | 对象数组 | 可选的 | ||||||
sharding.collections._id | 字符串 | 可选的 | collection的命名空间。命名空间是数据库名称和collection名称的组合。例如, testdb.testcoll 。 | |||||
sharding.collections.key | 数组的数组 | 可选的 | 集合的分片键。 它包含:
| |||||
sharding.collections.unique | 布尔 | 可选的 | Flag that indicates whether MongoDB | |||||
sharding.shards | 对象数组 | 可选的 | 集群的分片。 | |||||
sharding.shards._id | 字符串 | 可选的 | 分片的名称。 | |||||
sharding.shards.rs | 字符串 | 可选的 | 分片副本集的名称。 这是在replicaSets._id 参数。 | |||||
sharding.shards.tags | 字符串数组 | 可选的 | 分配给此分片的区域。 如果使用分区分片,则可以添加此数组参数。 | |||||
sharding.tags | 对象数组 | 可选的 | 区域分片的区域定义。 此数组中的每个对象都定义一个区域并配置该区域的分片键范围。 | |||||
sharding.tags.ns | 字符串 | 可选的 | 使用分区分片的集合的命名空间。 命名空间结合了数据库名称和集合名称。 示例: | |||||
sharding.tags.min | 阵列 | 可选的 | 分片键范围的最小值。 在以下形式的文档中指定字段名称、字段类型和值。
要使用复合分片键,请在单独的文档中指定每个字段,如此表后面的示例所示。 有关分片键的更多信息,请参阅 MongoDB 手册中的分片键。 | |||||
sharding.tags.max | 阵列 | 可选的 | 分片键范围的最大值。 在以下形式的文档中指定字段名称、字段类型和值。
要使用复合分片键,请在单独的文档中指定每个字段,如此表后面的示例所示。 有关分片键的更多信息,请参阅 MongoDB 手册中的分片键。 | |||||
sharding.tags.tag | 字符串 | 可选的 | Name of the zone associated with the shard key range specified by sharding.tags.min and sharding.tags.max. |
例子
具有复合分片键的 sharding.tags 数组
以下示例配置定义了一个复合分片键范围,其最小值为{ a: 1, b: ab } ,最大值为{ a: 100, b: fg } 。 该示例在testdb.test1collection上定义范围并将其分配给区域zone1 。
1 "tags" : [ 2 { 3 "ns" : "testdb.test1", 4 "min" : [ 5 { 6 "parameter" : "a", 7 "parameterType" : "integer", 8 "value" : "1" 9 }, 10 { 11 "parameter" : "b", 12 "parameterType" : "string", 13 "value" : "ab" 14 } 15 ], 16 "max" : [ 17 { 18 "parameter" : "a", 19 "parameterType" : "integer", 20 "value" : "100" 21 }, 22 { 23 "parameter" : "b", 24 "parameterType" : "string", 25 "value" : "fg" 26 } 27 ], 28 "tag" : "zone1" 29 } 30 ]
集群负载均衡器
负载均衡器对象是可选的,用于定义每个集群的负载均衡器设置。
1 "balancer": { 2 "<clusterName1>": {}, 3 "<clusterName2>": {}, 4 ... 5 }
名称 | 类型 | 必要性 | 说明 |
|---|---|---|---|
平衡器 | 对象 | Optional | 根据集群命名的参数,每个参数都包含一个对象,该对象具有集群所需的负载均衡器设置。 该对象使用“ stopped ”(停止)和“activeWindow ”(活动窗口)参数,如 MongoDB 手册中的本教程中安排均衡窗口的过程中所述。 |
身份验证
Cloud Manager 不需要auth对象。 该对象定义与身份验证相关的设置。
1 { 2 "auth": { 3 "authoritativeSet": "<boolean>", 4 "autoUser": "<string>", 5 "autoPwd": "<string>", 6 "disabled": "<boolean>", 7 "deploymentAuthMechanisms": ["<string>", "<string>"], 8 "autoAuthMechanisms": ["<string>"], 9 "key": "<string>", 10 "keyfile": "<string>", 11 "newAutoPwd": "<string>", 12 "newKey": "<string>", 13 "usersDeleted": [{ 14 "user": "<string>", 15 "dbs": ["<string>", "<string>"] 16 }], 17 "usersWanted": [{ 18 "authenticationRestrictions": [{ 19 "clientSource": ["(IP | CIDR range)", "(IP | CIDR range)"], 20 "serverAddress": ["(IP | CIDR range)", "(IP | CIDR range)"] 21 }], 22 "db": "<string>", 23 "initPwd": "<string>", 24 "otherDBRoles": { 25 "<string>": ["<string>", "<string>"] 26 }, 27 "roles": [{ 28 "db": "<string>", 29 "role": "<string>" 30 }], 31 "pwd": "<string>", 32 "user": "<string>" 33 }] 34 } 35 }
名称 | 类型 | 必要性 | 说明 | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
auth | 对象 | Optional | 定义与身份验证相关的设置。 如果省略此参数,请跳过本节的其余部分。 | ||||||||||||
auth.authoritativeSet | 布尔 | 可选的 | 设置 Cloud Manager 是否在项目的所有托管部署中实施一组一致的托管 MongoDB 用户和角色。
auth.authoritativeSet默认为false 。 如果"auth" 为 true ,则为必填项。 | ||||||||||||
auth.autoUser | 字符串 | 可选的 | 自动化连接到实例时使用的用户名。 如果"auth" 为 true ,则为必填项。 | ||||||||||||
auth.autoPwd | 字符串 | 可选的 | 自动化连接到实例时使用的密码。 如果"auth" 为 true ,则为必填项。 | ||||||||||||
auth.disabled | 布尔 | Optional | 指示身份验证是否已禁用的标志。 如果未指定,则禁用默认为false 。 | ||||||||||||
auth.deploymentAuthMechanisms | 字符串数组 | 可选的 | 列出部署中的进程支持的身份验证机制。 如果"auth" 为 true ,则为必填项。 指定:
| ||||||||||||
auth.autoAuthMechanisms | 字符串数组 | 可选的 | 设置自动化使用的身份验证机制。 如果未指定,则禁用默认为false 。 如果"auth" 为 true ,则为必填项。 仅当为 SCRAM-SHA-1 和 SCRAM-SHA-256 配置时,此参数才包含多个元素。 指定:
| ||||||||||||
auth.key | 字符串 | 可选的 | Cloud Manager 用于向 MongoDB 进程进行身份验证的密钥文件的内容。 如果"auth" : true且"auth.disabled" : false ,则为必填项。 如果更改auth.key值,则必须更改auth.keyfile值。 | ||||||||||||
auth.keyfile | 字符串 | 可选的 | Cloud Manager 用于对 MongoDB 进程进行身份验证的密钥文件的路径和名称。 如果"auth" : true且"auth.disabled" : false ,则为必填项。 如果更改auth.keyfile值,则必须更改auth.key值。 | ||||||||||||
auth | 字符串 | Optional | 自动化连接到实例时使用的新密码。 要在不中断连接的情况下轮换密码,请执行以下操作:
仅当您将 SCRAM-SHA-1 或 SCRAM-SHA-256 作为auth.autoAuthMechanisms中自动化的身份验证机制之一时,才能设置此选项。 | ||||||||||||
auth.newKey | 字符串 | Optional | 您希望 Cloud Manager 使用该文件对 MongoDB 进程进行身份验证的新密钥文件的内容。 设置此选项时,Cloud Manager 会轮换应用程序用于对部署中的 MongoDB 进程进行身份验证的密钥。当所有 MongoDB 代理都使用新密钥时,Cloud Manager 会将auth.key的值替换为您在auth.newKey中提供的新密钥,并从自动化配置中删除auth.newKey 。 | ||||||||||||
auth.usersDeleted | 对象数组 | Optional | 定义要从指定数据库或所有数据库中删除的经过身份验证的用户的对象。 此数组必须包含auth.usersDeleted.user和auth.usersDeleted.dbs 。 | ||||||||||||
auth.usersDeleted[n].user | 字符串 | Optional | Cloud Manager 应删除的用户的用户名。 | ||||||||||||
auth.usersDeleted[n].dbs | 字符串数组 | Optional | 列出 Cloud Manager 应从中删除经过身份验证的用户的数据库的名称。 | ||||||||||||
auth.usersWanted | 对象数组 | Optional | 包含对象,这些对象定义要添加到指定数据库的经过身份验证的用户。 每个对象都必须具有auth.usersWanted[n].db 、 auth.usersWanted[n].user 、 和auth.usersWanted[n].角色 参数,然后恰好具有以下参数之一: auth.usersWanted[n].pwd , auth.usersWanted[n].initPwd 、 或auth.usersWanted[n].userSource 。 | ||||||||||||
auth.usersWanted[n].db | 字符串 | 可选的 | 要添加用户的数据库。 | ||||||||||||
auth.usersWanted[n].user | 字符串 | 可选的 | Cloud Manager 应添加的用户名称。 | ||||||||||||
auth.usersWanted[n].角色 | 阵列 | 可选的 | 要从用户数据库分配给用户的角色列表,在auth.usersWanted[n].db中指定。 | ||||||||||||
auth.usersWanted[n].pwd | 字符串 | 可选的 | 当前分配给用户的密码的 32 字符十六进制SCRAM-SHA-1哈希值。 Cloud Manager 不会使用此参数来设置或更改密码。 在以下情况下为必填项:
| ||||||||||||
auth.usersWanted[n].initPwd | 字符串 | 可选的 | 要分配给用户的明文密码。 在以下情况下为必填项:
| ||||||||||||
auth.usersWanted[n].userSource | 字符串 | 已弃用 | 不再支持。 | ||||||||||||
auth.usersWanted[n].otherDBRoles | 对象 | Optional | 如果分配用户的数据库"auth.usersWanted[n].db" : "admin" ,那么您也可以使用此对象分配其他数据库中的用户角色。 该对象包含键值对,其中键是数据库的名称,值是列出从该数据库分配的角色的字符串值数组。 | ||||||||||||
auth.usersWanted[n].authenticationRestrictions | 文档数组 | Optional | 主机对用户实施的身份验证限制。 警告:如果用户继承的多个角色具有不兼容的身份验证限制,则该用户将无法使用。 示例,如果用户继承了一个角色(其中 | ||||||||||||
auth.usersWanted[n].authenticationRestrictions[k].clientSource | 字符串数组 | 可选的 | 如果在对用户进行身份验证时存在,则主机将验证给定列表是否包含客户端的 IP 地址CIDR范围。 如果客户端的 IP 地址不存在,则主机不会对用户进行身份验证。 | ||||||||||||
auth.usersWanted[n].authenticationRestrictions[k].serverAddress | 字符串数组 | 可选的 | 客户端可以连接的以逗号分隔的 IP 地址数组。 如果存在,则主机验证 Cloud Manager 是否接受了来自给定数组中 IP 地址的客户端连接。如果从无法识别的 IP 地址接受连接,则主机不会对用户进行身份验证。 |
LDAP
ldap对象启用LDAP授权。此对象是可选的。 要学习;了解更多信息,请参阅启用LDAP身份验证。
"ldap": { "servers": "<host>:<port>, <host>:<port>", "timeoutMS": "<time>", "bindMethod": "<sasl/simple>", "bindSaslMechanisms": "<sasl-mechanism>, <sasl-mechanism>", "bindQueryUser": <ldap-dn>", "bindQueryPassword": "<password>", "userCacheInvalidationPeriod": "<interval>", "authzQueryTemplate": "<rfc-4516-url>", "userToDNMapping": [ { "match": "<ECMAScript-regex>", "<substition/ldapQuery>": "<DN-string/RFC4516-encoded-LDAP-query>" } ] }
名称 | 类型 | 必要性 | 说明 |
|---|---|---|---|
ldap | 对象 | Optional | 包含用于启用和配置LDAP授权的设置的对象。 |
ldap.servers | 字符串 | 可选的 | Comma-separated string that contains one or more LDAP servers in |
ldap.timeoutMS | long | Optional | Amount of time in milliseconds that MongoDB waits for an LDAP server to respond to a request before timing out. You can use |
ldap.bindMethod | 字符串 | Optional | Human-readable string that indicates whether to use simple authentication or an SASL protocol to authenticate itself. You can specify |
ldap.bindSaslMechanisms | 字符串 | Optional | String that contains a comma-separated list of SASL mechanisms for MongoDB to attempt authentication against the LDAP server while binding. By default, MongoDB uses |
ldap.bindQueryUser | 字符串 | 可选的 | LDAP entity domain name that MongoDB binds as when it connects to an LDAP server. You can use |
ldap.bindQueryPassword | 字符串 | 可选的 | Password that MongoDB binds with when it connects to an LDAP server. You can use |
ldap.userCacheInvalidationPeriod | 整型 | Optional | MongoDB在用户缓存刷新之间等待的时间间隔。刷新外部用户缓存后, LDAP授权用户执行的下一个操作需要重新获取角色。如果指定较高的值,则可能会减少LDAP服务器上的负载,并增加将MongoDB角色与LDAP群组成员身份同步所需的时间。默认下, MongoDB在缓存刷新之间等待 30 秒。 |
ldap.authzQueryTemplate | 字符串 | 可选的 | RFC 4516 格式的LDAP查询URL ,执行该查询以获得与 |
ldap.userToDNMapping | 阵列 | Optional | JSON-formatted array that contains the ordered transformations that MongoDB applies to authenticate MongoDB user names to match their domain names. You can specify this setting if you use an alternate authentication method, or if the user name passed to MongoDB for authentication doesn't match the LDAP domain name. You can use |
TLS
tls对象启用TLS来加密连接。 此对象是可选的。
"tls" : { "CAFilePath" : "<string>" }
名称 | 类型 | 必要性 | 说明 |
|---|---|---|---|
TLS | 对象 | Optional | 启用TLS以加密连接。 要使用TLS ,请选择支持TLS的包。 所有支持MongoDB Enterprise的平台也都支持TLS 。 |
tls.CAFilePath | 字符串 | 可选的 | 用于通过TLS进行身份验证的证书的绝对文件路径。 如果设置了 tls.clientCertificateMode ,则为必填项。 |
tls.clientCertificateMode | 字符串 | 可选的 | 关于与 Cloud Manager 的连接是否需要TLS证书的声明。 Cloud Manager 接受OPTIONAL和REQUIRE 。 如果设置了 tls.CAFilePath ,则为必填项。 |
MongoDB 角色
roles数组是可选的,用于描述用户定义的角色。
1 "roles" : [ 2 { 3 "role" : "<string>", 4 "db" : "<string>", 5 "privileges" : [ 6 { 7 "resource" : { ... }, 8 "actions" : [ "<string>", ... ] 9 }, 10 ... 11 ], 12 "roles" : [ 13 { 14 "role" : "<string>", 15 "db" : "<string>" 16 } 17 ] 18 "authenticationRestrictions" : [ 19 { 20 "clientSource": [("<IP>" | "<CIDR range>"), ...], 21 "serverAddress": [("<IP>" | "<CIDR range>"), ...] 22 }, ... 23 ] 24 }, 25 ... 26 ]
名称 | 类型 | 必要性 | 说明 |
|---|---|---|---|
角色 | 对象数组 | Optional | MongoDB 分配给集群的用户定义角色的角色和权限。 每个对象描述一个不同的用户定义角色。 此数组中的对象包含与系统角色集合中的文档相同的字段,但_id字段除外。 |
roles[n].role | 字符串 | 可选的 | 用户定义角色的名称。 |
roles[n].db | 字符串 | 可选的 | 自定义角色所属的数据库。 |
roles[n].privileges | 文档数组 | 可选的 | 此角色可以执行的特权。 |
roles[n].privileges[k].resource | 字符串 | 可选的 | 指定权限操作适用的资源。 |
roles[n].privileges[k].actions | 字符串 | 可选的 | 允许对资源执行的操作。 要学习;了解更多信息,请参阅特权操作。 |
roles[n].roles | 文档数组 | 可选的 | 此角色从中继承权限的角色。 |
角色[n].authenticationRestrictions | 文档数组 | Optional | MongoDB Server 对此角色实施的身份验证限制。 警告:如果用户继承的多个角色具有不兼容的身份验证限制,则该用户将无法使用。 示例,如果用户继承了一个角色(其中 |
角色[n].authenticationRestrictions[k].clientSource | 字符串数组 | 可选的 | 如果存在,则在对用户进行身份验证时,MongoDB 服务器会验证客户端的 IP 地址是否在给定列表中或属于列表中的CIDR范围。 如果客户端的 IP 地址不存在,则 MongoDB Server 不会对用户进行身份验证。 |
角色[n].authenticationRestrictions[k].serverAddress | 字符串数组 | 可选的 | 客户端可以连接的以逗号分隔的 IP 地址数组。 如果存在,MongoDB Server会验证它是否接受了来自给定数组中 IP 地址的客户端连接。如果 MongoDB Server 接受来自无法识别的 IP 地址的连接,则 MongoDB Server 不会对用户进行身份验证。 |
Kerberos
kerberos对象是可选的,它定义身份验证中使用的 kerberos 服务名称。
"kerberos": { "serviceName": "<string>" }
名称 | 类型 | 必要性 | 说明 |
|---|---|---|---|
kerberos | 对象 | Optional | 定义 Kerberos 服务名称代理用于通过 Kerberos 进行身份验证的键值对。 |
kerberos.serviceName | 字符串 | 必需 | 设置以下内容的标签:
|
索引
indexConfigs数组是可选的,用于定义要为特定副本集构建的索引。
1 "indexConfigs": [{ 2 "key": [ 3 ["<string>", "<value>"] 4 ], 5 "rsName": "<string>", 6 "dbName": "<string>", 7 "collectionName": "<string>", 8 "collation": { 9 "locale": "<string>", 10 "caseLevel": <boolean>, 11 "caseFirst": "<string>", 12 "strength": <number>, 13 "numericOrdering": <boolean>, 14 "alternate": "<string>", 15 "maxVariable": "<string>", 16 "normalization": <boolean>, 17 "backwards": <boolean> 18 }, 19 "options": { 20 "<key>": "<value>" 21 } 22 }]
名称 | 类型 | 必要性 | 说明 | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
indexConfigs | 对象数组 | Optional | 为特定副本集构建的特定索引。 | |||||||||
indexConfigs.key | 数组的数组 | 必需 | 索引中的键。 如果索引只有一个键,则此“数组的数组”包含单个数组。 | |||||||||
indexConfigs.rsName | 字符串 | 必需 | MongoDB 在其上构建索引的副本集。 | |||||||||
indexConfigs.dbName | 字符串 | 必需 | MongoDB 建立索引的数据库。 | |||||||||
indexConfigs.collectionName | 字符串 | 必需 | MongoDB 索引的collection。 | |||||||||
indexConfigs.collation | 对象 | Optional | 如果索引使用排序规则,则在对字符串进行排序和匹配时要使用的特定于语言的规则。 如果包含indexConfigs.collation对象,则必须包含indexConfigs.collation.locale参数。 所有其他参数都是可选的。 如果不包含indexConfigs.collation对象,则索引无法包含排序规则。 | |||||||||
indexConfigs.collation.locale | 字符串 | 必需 | ||||||||||
indexConfigs.collation.caseLevel | 布尔 | Optional | 指示索引如何使用案例的标志。 如果将此参数设置为true ,则索引将使用大小写比较。 仅当将indexConfigs.collation.strength设置为1或2时,此参数才会应用。 要学习;了解详情,请参阅排序规则。 | |||||||||
indexConfigs.collation.caseFirst | 字符串 | Optional | 三级比较期间大小写差异的排序顺序。 MongoDB Server手册在其排序规则部分列出了可能的值。 | |||||||||
indexConfigs.collation.strength | 数字 | Optional | ||||||||||
indexConfigs.collation.numericOrdering | 布尔 | Optional | 指示如何比较数字字符串的标志。
默认为false 。 要学习;了解详情,请参阅排序规则。 | |||||||||
indexConfigs.collation.alternate | 字符串 | Optional | 用于确定排序规则在比较期间如何将空格和标点符号视为基本字符的设置。 MongoDB Server手册在其排序规则部分列出了可能的值。 | |||||||||
indexConfigs.collation.maxVariable | 字符串 | Optional | 索引可以忽略的字符。 此参数仅在将indexConfigs.collation.alternate设置为shifted时适用。 MongoDB Server手册在其排序规则部分列出了可能的值。 | |||||||||
indexConfigs.collation.normalization | 布尔 | Optional | ||||||||||
indexConfigs.collation.backwards | 布尔 | Optional | 指示索引应如何处理变音符号字符串的标志。 要学习;了解详情,请参阅排序规则。 | |||||||||
indexConfigs.options | 文档 | 必需 | MongoDB Go 驱动程序支持的索引选项。 |