elasticsearch/docs/reference/snapshot-restore/apis/put-repo-api.asciidoc
David Turner ccbb5badce
Fix support for infinite ?master_timeout (#107050)
Specifying `?master_timeout=-1` on an API which performs a cluster state
update means that the cluster state update task will never time out
while waiting in the pending tasks queue. However this parameter is also
re-used in a few places where a timeout of `-1` means something else,
typically to timeout immediately. This commit fixes those places so that
`?master_timeout=-1` consistently means to wait forever.
2024-04-10 18:32:38 +01:00

122 lines
3.4 KiB
Text

[[put-snapshot-repo-api]]
=== Create or update snapshot repository API
++++
<titleabbrev>Create or update snapshot repository</titleabbrev>
++++
Registers or updates a <<snapshots-register-repository,snapshot repository>>.
[source,console]
----
PUT /_snapshot/my_repository
{
"type": "fs",
"settings": {
"location": "my_backup_location"
}
}
----
IMPORTANT: If you're migrating {ref}/searchable-snapshots.html[searchable snapshots], the repository's name must be identical in the source and destination clusters.
[[put-snapshot-repo-api-request]]
==== {api-request-title}
`PUT /_snapshot/<repository>`
`POST /_snapshot/<repository>`
[[put-snapshot-repo-api-prereqs]]
==== {api-prereq-title}
* If the {es} {security-features} are enabled, you must have the `manage`
<<privileges-list-cluster,cluster privilege>> to use this API.
// tag::put-repo-api-prereqs[]
* To register a snapshot repository, the cluster's global metadata must be
writeable. Ensure there aren't any <<cluster-read-only,cluster blocks>> that
prevent write access.
// end::put-repo-api-prereqs[]
[[put-snapshot-repo-api-path-params]]
==== {api-path-parms-title}
`<repository>`::
(Required, string)
Name of the snapshot repository to register or update.
[[put-snapshot-repo-api-query-params]]
==== {api-query-parms-title}
IMPORTANT: Several options for this API can be specified using a query parameter
or a request body parameter. If both parameters are specified, only the query
parameter is used.
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=master-timeout]
`timeout`::
(Optional, <<time-units, time units>>) Specifies the period of time to wait for
a response. If no response is received before the timeout expires, the request
fails and returns an error. Defaults to `30s`.
`verify`::
(Optional, Boolean)
If `true`, the request verifies the repository is functional on all master and
data nodes in the cluster. If `false`, this verification is skipped. Defaults to
`true`.
+
You can manually perform this verification using the
<<verify-snapshot-repo-api,verify snapshot repository API>>.
[role="child_attributes"]
[[put-snapshot-repo-api-request-body]]
==== {api-request-body-title}
[[put-snapshot-repo-api-request-type]]
`type`::
(Required, string)
Repository type.
+
.Valid values for `type`
[%collapsible%open]
====
`azure`:: <<repository-azure>>
`gcs`:: <<repository-gcs>>
`s3`:: <<repository-s3>>
`fs`:: <<snapshots-filesystem-repository>>
`source`:: <<snapshots-source-only-repository>>
`url`:: <<snapshots-read-only-repository>>
Other repository types are available through official plugins:
`hdfs`:: {plugins}/repository-hdfs.html[Hadoop Distributed File System (HDFS) repository]
====
[[put-snapshot-repo-api-settings-param]]
`settings`::
(Required, object)
Settings for the repository. Supported settings vary based on the repository
type:
+
--
* <<repository-azure>>
* <<repository-gcs>>
* <<repository-s3>>
* <<snapshots-filesystem-repository>>
* <<snapshots-read-only-repository>>
* <<snapshots-source-only-repository>>
Other repository types are available through official plugins:
* {plugins}/repository-hdfs.html[Hadoop Distributed File System (HDFS) repository]
--
`verify`::
(Optional, Boolean)
If `true`, the request verifies the repository is functional on all master and
data nodes in the cluster. If `false`, this verification is skipped. Defaults to
`true`.
+
You can manually perform this verification using the
<<snapshots-repository-verification,verify snapshot repository API>>.