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

获取一个集群的一张快照

基本 URL: https://cloud.mongodb.com/api/public/v1.0

GET /groups/{PROJECT-ID}/clusters/{CLUSTER-ID}/snapshots/{SNAPSHOT-ID}
名称
类型
必要性
说明

PROJECT-ID

字符串

必需

Unique identifier of the project that owns the snapshot.

CLUSTER-ID

字符串

必需

快照所代表的集群的唯一标识符。

SNAPSHOT-ID

字符串

必需

以下查询参数为可选参数:

名称
类型
必要性
说明
默认

pretty

布尔

Optional

指示响应正文是否应采用 prettyprint 格式的标记。

false

envelope

布尔

Optional

指示是否将响应包装在信封中的标志。

某些 API 客户端无法访问 HTTP 响应标头或状态代码。要解决这个问题,可在查询中设置 envelope=true

对于返回一个结果的端点,响应体包括:

名称
说明

status

HTTP 响应代码

content

预期响应正文

false

此端点不使用 HTTP 请求正文参数。

Name
类型
说明

clusterId

字符串

快照所代表集群的唯一标识符。

complete

布尔

指示快照已创建的标志。 如果快照创建作业仍在进行中,则为false

created

文档

Components of a timestamp.

created
.date

timestamp

iso 8601 - 拍摄快照的时间。

created
.increment

整型

快照在此时发生的操作顺序。 要了解时间戳在 MongoDB 中的工作原理,请参阅时间戳。

doNotDelete

布尔

指示无法删除快照的标志。

expires

timestamp

UTC 格式的 ISO8601 日期和时间格式的时间戳,之后可以删除此快照。

如果将doNotDelete设置为true ,则删除expires中的所有值。

如果expires值早于当前日期和时间,则无法编辑。

groupId

字符串

Unique identifier of the project that owns the snapshot.

id

字符串

isPossibly
Inconsistent

布尔

指示此快照一致性的标志。 isPossiblyInconsistent仅针对分片集群快照显示。

To take a snapshot of a sharded cluster in a consistent state, the Backup temporarily turns off the balancer before creating the snapshot. In some cases, it cannot turn off the balancer in a timely manner. The snapshot is then created with the balancer still running.

如果发生这种情况,则快照可能处于不一致状态(例如,数据块迁移可能正在进行中)。

lastOplog
AppliedTimestamp

文档

应用了最后一个 oplog 条目的时间戳组件。

lastOplog
AppliedTimestamp
.date

timestamp

应用最后一个oplog时,采用 ISO 8601 日期和时间格式(UTC 时间)的时间戳。

lastOplog
AppliedTimestamp
.increment

整型

在此确切时间点应用最后一个oplog的操作顺序。 要了解时间戳在 MongoDB 中的工作原理,请参阅时间戳。

links

对象数组

指向子资源和/或相关资源的一个或多个链接。响应中的所有 links 数组至少包含一个名为 self 的链接。URL之间的关系在 Web 链接规范中进行了解释。

namespaceFilterList

对象

namespaceFilterList
.filterList

字符串数组

以逗号分隔的列表,其中包含以独占方式包含在快照中或显式排除在快照中的数据库或命名空间的任意组合。

默认值为空数组 ( [] )。

namespaceFilterList
.filterType

字符串

用于确定如何为此快照筛选命名空间的标签。

  • 如果将此值设置为denyList ,则快照中会排除namespaceFilterList.filterList中的命名空间。

  • 如果将此值设置为accessList ,则快照中仅包含namespaceFilterList.filterList中的命名空间。

默认值为 denyList

missingShards

对象数组

快照缺少的分片列表。 missingShards仅针对分片集群快照显示。

In steady state, this array is empty. If the Backup cannot connect to a shard when a snapshot is created, the shard is omitted from the snapshot. Each document in the array is a cluster document containing a self link.

missingShards
.id

字符串

缺失分片的唯一标识符

missingShards
.groupId

字符串

拥有缺失分片的项目的唯一标识符

missingShards
.typeName

字符串

缺失分代表的服务器类型:

  • CONFIG_SERVER_REPLICA_SET

  • REPLICA_SET

  • CONFIG_SHARD_REPLICA_SET

missingShards
.clusterName

字符串

缺失分片的集群名称

missingShards
.shardName

字符串

缺失分片的名称

missingShards
.replicaSetName

字符串

missingShards
.lastHeartbeat

timestamp

从缺失分片收到最后一次心跳的时间戳,采用 ISO8601 日期和时间格式(UTC 时间)。

parts

对象数组

构成完整快照的各个部分。

parts
.clusterId

字符串

Unique identifier of the replica set.

parts
.compressionSetting

字符串

parts
.dataSizeBytes

数字

快照中数据的总大小(以字节为单位)。

parts
.encryptionEnabled

布尔

快照数据加密状态的指示器。

parts
.fileSizeBytes

数字

数据文件的总大小(以字节为单位)。

parts
.masterKeyUUID

字符串

KMIP master key ID used to encrypt the snapshot data. parts.masterKeyUUID appears only if this snapshot has parts.encryptionEnabled : true.

parts
.mongodVersion

字符串

Version of mongod that the replica set primary was running when the snapshot was created.

parts
.replicaSetName

字符串

Name of the replica set.

parts
.storageSizeBytes

数字

为文档存储分配的空间总大小。

parts
.typeName

字符串

该部分代表的服务器类型:

  • REPLICA_SET

  • CONFIG_SERVER_REPLICA_SET

  • CONFIG_SHARD_REPLICA_SET

curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \
--header "Accept: application/json" \
--include \
--request GET "https://cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-ID}/clusters/{CLUSTER-ID}/snapshots/{SNAPSHOT-ID}?pretty=true"
HTTP/1.1 401 Unauthorized
Content-Type: application/json;charset=ISO-8859-1
Date: {dateInUnixFormat}
WWW-Authenticate: Digest realm="MMS Public API", domain="", nonce="{nonce}", algorithm=MD5, op="auth", stale=false
Content-Length: {requestLengthInBytes}
Connection: keep-alive
HTTP/1.1 200 OK
Vary: Accept-Encoding
Content-Type: application/json
Strict-Transport-Security: max-age=300
Date: {dateInUnixFormat}
Connection: keep-alive
Content-Length: {requestLengthInBytes}
X-MongoDB-Service-Version: gitHash={gitHash}; versionString={ApplicationVersion}
{
"clusterId" : "{CLUSTER-ID}",
"complete" : true,
"created" : {
"date" : "2016-08-21T23:47:38Z",
"increment" : 1
},
"doNotDelete" : false,
"expires" : "2017-08-20T23:47:38Z",
"groupId" : "{PROJECT-ID}",
"id" : "{SNAPSHOT-ID}",
"lastOplogAppliedTimestamp" : {
"date" : "2017-08-21T09:14:51Z",
"increment" : 1
},
"links" : [ {
"href" : "https://cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-ID}/clusters/{CLUSTER-ID}/snapshots/{SNAPSHOT-ID}",
"rel" : "self"
} ],
"namespaceFilterList" : {
"filterList" : [ ],
"filterType" : "denyList"
},
"parts" : [ {
"clusterId" : "{CLUSTER-ID}",
"compressionSetting" : "GZIP",
"dataSizeBytes" : 503779557,
"encryptionEnabled" : false,
"fileSizeBytes" : 2855605344,
"mongodVersion" : "4.0.9",
"replicaSetName" : "proton",
"storageSizeBytes" : 547516416,
"typeName" : "REPLICA_SET"
} ]
}