Convert curl examples to Sense for snapshot restore
Closes #11537 Conflicts: docs/reference/modules/snapshots.asciidoc
This commit is contained in:
parent
11330d1a34
commit
e8d5b8ce4b
|
@ -13,28 +13,33 @@ Elasticsearch. The repository settings are repository-type specific. See below f
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
$ curl -XPUT 'http://localhost:9200/_snapshot/my_backup' -d '{
|
PUT /_snapshot/my_backup
|
||||||
"type": "REPOSITORY TYPE",
|
{
|
||||||
"settings": {
|
"type": "fs",
|
||||||
|
"settings": {
|
||||||
... repository specific settings ...
|
... repository specific settings ...
|
||||||
}
|
}
|
||||||
}'
|
}
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
|
||||||
Once a repository is registered, its information can be obtained using the following command:
|
Once a repository is registered, its information can be obtained using the following command:
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
$ curl -XGET 'http://localhost:9200/_snapshot/my_backup?pretty'
|
GET /_snapshot/my_backup
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
// AUTOSENSE
|
||||||
|
|
||||||
|
which returns:
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
{
|
{
|
||||||
"my_backup" : {
|
"my_backup": {
|
||||||
"type" : "fs",
|
"type": "fs",
|
||||||
"settings" : {
|
"settings": {
|
||||||
"compress" : "true",
|
"compress": "true",
|
||||||
"location" : "/mount/backups/my_backup"
|
"location": "/mount/backups/my_backup"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,14 +50,14 @@ all repositories currently registered in the cluster:
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
$ curl -XGET 'http://localhost:9200/_snapshot'
|
GET /_snapshot
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
|
||||||
or
|
or
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
$ curl -XGET 'http://localhost:9200/_snapshot/_all'
|
GET /_snapshot/_all
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
|
||||||
[float]
|
[float]
|
||||||
|
@ -136,21 +141,24 @@ verification when registering or updating a repository:
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
$ curl -XPUT 'http://localhost:9200/_snapshot/s3_repository?verify=false' -d '{
|
PUT /_snapshot/s3_repository?verify=false
|
||||||
"type": "s3",
|
{
|
||||||
"settings": {
|
"type": "s3",
|
||||||
"bucket": "my_s3_bucket",
|
"settings": {
|
||||||
"region": "eu-west-1",
|
"bucket": "my_s3_bucket",
|
||||||
}
|
"region": "eu-west-1"
|
||||||
}'
|
}
|
||||||
|
}
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
// AUTOSENSE
|
||||||
|
|
||||||
The verification process can also be executed manually by running the following command:
|
The verification process can also be executed manually by running the following command:
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
$ curl -XPOST 'http://localhost:9200/_snapshot/my_backup/_verify'
|
POST /_snapshot/my_backup/_verify
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
// AUTOSENSE
|
||||||
|
|
||||||
It returns a list of nodes where repository was successfully verified or an error message if verification process failed.
|
It returns a list of nodes where repository was successfully verified or an error message if verification process failed.
|
||||||
|
|
||||||
|
@ -163,8 +171,9 @@ command:
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
$ curl -XPUT "localhost:9200/_snapshot/my_backup/snapshot_1?wait_for_completion=true"
|
PUT /_snapshot/my_backup/snapshot_1?wait_for_completion=true
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
// AUTOSENSE
|
||||||
|
|
||||||
The `wait_for_completion` parameter specifies whether or not the request should return immediately after snapshot
|
The `wait_for_completion` parameter specifies whether or not the request should return immediately after snapshot
|
||||||
initialization (default) or wait for snapshot completion. During snapshot initialization, information about all
|
initialization (default) or wait for snapshot completion. During snapshot initialization, information about all
|
||||||
|
@ -176,12 +185,14 @@ specifying the list of indices in the body of the snapshot request.
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
$ curl -XPUT "localhost:9200/_snapshot/my_backup/snapshot_1" -d '{
|
PUT /_snapshot/my_backup/snapshot_1
|
||||||
"indices": "index_1,index_2",
|
{
|
||||||
"ignore_unavailable": "true",
|
"indices": "index_1,index_2",
|
||||||
"include_global_state": false
|
"ignore_unavailable": "true",
|
||||||
}'
|
"include_global_state": false
|
||||||
|
}
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
// AUTOSENSE
|
||||||
|
|
||||||
The list of indices that should be included into the snapshot can be specified using the `indices` parameter that
|
The list of indices that should be included into the snapshot can be specified using the `indices` parameter that
|
||||||
supports <<search-multi-index-type,multi index syntax>>. The snapshot request also supports the
|
supports <<search-multi-index-type,multi index syntax>>. The snapshot request also supports the
|
||||||
|
@ -215,15 +226,17 @@ Once a snapshot is created information about this snapshot can be obtained using
|
||||||
|
|
||||||
[source,shell]
|
[source,shell]
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
$ curl -XGET "localhost:9200/_snapshot/my_backup/snapshot_1"
|
GET /_snapshot/my_backup/snapshot_1
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
// AUTOSENSE
|
||||||
|
|
||||||
All snapshots currently stored in the repository can be listed using the following command:
|
All snapshots currently stored in the repository can be listed using the following command:
|
||||||
|
|
||||||
[source,shell]
|
[source,shell]
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
$ curl -XGET "localhost:9200/_snapshot/my_backup/_all"
|
GET /_snapshot/my_backup/_all
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
// AUTOSENSE
|
||||||
|
|
||||||
coming[2.0] A currently running snapshot can be retrieved using the following command:
|
coming[2.0] A currently running snapshot can be retrieved using the following command:
|
||||||
|
|
||||||
|
@ -236,8 +249,9 @@ A snapshot can be deleted from the repository using the following command:
|
||||||
|
|
||||||
[source,shell]
|
[source,shell]
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
$ curl -XDELETE "localhost:9200/_snapshot/my_backup/snapshot_1"
|
DELETE /_snapshot/my_backup/snapshot_1
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
// AUTOSENSE
|
||||||
|
|
||||||
When a snapshot is deleted from a repository, Elasticsearch deletes all files that are associated with the deleted
|
When a snapshot is deleted from a repository, Elasticsearch deletes all files that are associated with the deleted
|
||||||
snapshot and not used by any other snapshots. If the deleted snapshot operation is executed while the snapshot is being
|
snapshot and not used by any other snapshots. If the deleted snapshot operation is executed while the snapshot is being
|
||||||
|
@ -249,8 +263,9 @@ A repository can be deleted using the following command:
|
||||||
|
|
||||||
[source,shell]
|
[source,shell]
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
$ curl -XDELETE "localhost:9200/_snapshot/my_backup"
|
DELETE /_snapshot/my_backup
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
// AUTOSENSE
|
||||||
|
|
||||||
When a repository is deleted, Elasticsearch only removes the reference to the location where the repository is storing
|
When a repository is deleted, Elasticsearch only removes the reference to the location where the repository is storing
|
||||||
the snapshots. The snapshots themselves are left untouched and in place.
|
the snapshots. The snapshots themselves are left untouched and in place.
|
||||||
|
@ -262,8 +277,9 @@ A snapshot can be restored using the following command:
|
||||||
|
|
||||||
[source,shell]
|
[source,shell]
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
$ curl -XPOST "localhost:9200/_snapshot/my_backup/snapshot_1/_restore"
|
POST /_snapshot/my_backup/snapshot_1/_restore
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
// AUTOSENSE
|
||||||
|
|
||||||
By default, all indices in the snapshot as well as cluster state are restored. It's possible to select indices that
|
By default, all indices in the snapshot as well as cluster state are restored. It's possible to select indices that
|
||||||
should be restored as well as prevent global cluster state from being restored by using `indices` and
|
should be restored as well as prevent global cluster state from being restored by using `indices` and
|
||||||
|
@ -275,14 +291,16 @@ Set `include_aliases` to `false` to prevent aliases from being restored together
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
$ curl -XPOST "localhost:9200/_snapshot/my_backup/snapshot_1/_restore" -d '{
|
POST /_snapshot/my_backup/snapshot_1/_restore
|
||||||
"indices": "index_1,index_2",
|
{
|
||||||
"ignore_unavailable": "true",
|
"indices": "index_1,index_2",
|
||||||
"include_global_state": false,
|
"ignore_unavailable": "true",
|
||||||
"rename_pattern": "index_(.+)",
|
"include_global_state": false,
|
||||||
"rename_replacement": "restored_index_$1"
|
"rename_pattern": "index_(.+)",
|
||||||
}'
|
"rename_replacement": "restored_index_$1"
|
||||||
|
}
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
// AUTOSENSE
|
||||||
|
|
||||||
The restore operation can be performed on a functioning cluster. However, an existing index can be only restored if it's
|
The restore operation can be performed on a functioning cluster. However, an existing index can be only restored if it's
|
||||||
<<indices-open-close,closed>> and has the same number of shards as the index in the snapshot.
|
<<indices-open-close,closed>> and has the same number of shards as the index in the snapshot.
|
||||||
|
@ -308,14 +326,18 @@ the index `index_1` without creating any replicas while switching back to defaul
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
$ curl -XPOST "localhost:9200/_snapshot/my_backup/snapshot_1/_restore" -d '{
|
POST /_snapshot/my_backup/snapshot_1/_restore
|
||||||
"indices": "index_1",
|
{
|
||||||
"index_settings" : {
|
"indices": "index_1",
|
||||||
"index.number_of_replicas": 0
|
"index_settings": {
|
||||||
},
|
"index.number_of_replicas": 0
|
||||||
"ignore_index_settings": ["index.refresh_interval"]
|
},
|
||||||
}'
|
"ignore_index_settings": [
|
||||||
|
"index.refresh_interval"
|
||||||
|
]
|
||||||
|
}
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
// AUTOSENSE
|
||||||
|
|
||||||
Please note, that some settings such as `index.number_of_shards` cannot be changed during restore operation.
|
Please note, that some settings such as `index.number_of_shards` cannot be changed during restore operation.
|
||||||
|
|
||||||
|
@ -348,31 +370,35 @@ A list of currently running snapshots with their detailed status information can
|
||||||
|
|
||||||
[source,shell]
|
[source,shell]
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
$ curl -XGET "localhost:9200/_snapshot/_status"
|
GET /_snapshot/_status
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
// AUTOSENSE
|
||||||
|
|
||||||
In this format, the command will return information about all currently running snapshots. By specifying a repository name, it's possible
|
In this format, the command will return information about all currently running snapshots. By specifying a repository name, it's possible
|
||||||
to limit the results to a particular repository:
|
to limit the results to a particular repository:
|
||||||
|
|
||||||
[source,shell]
|
[source,shell]
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
$ curl -XGET "localhost:9200/_snapshot/my_backup/_status"
|
GET /_snapshot/my_backup/_status
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
// AUTOSENSE
|
||||||
|
|
||||||
If both repository name and snapshot id are specified, this command will return detailed status information for the given snapshot even
|
If both repository name and snapshot id are specified, this command will return detailed status information for the given snapshot even
|
||||||
if it's not currently running:
|
if it's not currently running:
|
||||||
|
|
||||||
[source,shell]
|
[source,shell]
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
$ curl -XGET "localhost:9200/_snapshot/my_backup/snapshot_1/_status"
|
GET /_snapshot/my_backup/snapshot_1/_status
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
// AUTOSENSE
|
||||||
|
|
||||||
Multiple ids are also supported:
|
Multiple ids are also supported:
|
||||||
|
|
||||||
[source,shell]
|
[source,shell]
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
$ curl -XGET "localhost:9200/_snapshot/my_backup/snapshot_1,snapshot_2/_status"
|
GET /_snapshot/my_backup/snapshot_1,snapshot_2/_status
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
// AUTOSENSE
|
||||||
|
|
||||||
[float]
|
[float]
|
||||||
=== Monitoring snapshot/restore progress
|
=== Monitoring snapshot/restore progress
|
||||||
|
@ -385,8 +411,9 @@ The snapshot operation can be also monitored by periodic calls to the snapshot i
|
||||||
|
|
||||||
[source,shell]
|
[source,shell]
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
$ curl -XGET "localhost:9200/_snapshot/my_backup/snapshot_1"
|
GET /_snapshot/my_backup/snapshot_1
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
// AUTOSENSE
|
||||||
|
|
||||||
Please note that snapshot info operation uses the same resources and thread pool as the snapshot operation. So,
|
Please note that snapshot info operation uses the same resources and thread pool as the snapshot operation. So,
|
||||||
executing a snapshot info operation while large shards are being snapshotted can cause the snapshot info operation to wait
|
executing a snapshot info operation while large shards are being snapshotted can cause the snapshot info operation to wait
|
||||||
|
@ -396,8 +423,9 @@ To get more immediate and complete information about snapshots the snapshot stat
|
||||||
|
|
||||||
[source,shell]
|
[source,shell]
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
$ curl -XGET "localhost:9200/_snapshot/my_backup/snapshot_1/_status"
|
GET /_snapshot/my_backup/snapshot_1/_status
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
// AUTOSENSE
|
||||||
|
|
||||||
While snapshot info method returns only basic information about the snapshot in progress, the snapshot status returns
|
While snapshot info method returns only basic information about the snapshot in progress, the snapshot status returns
|
||||||
complete breakdown of the current state for each shard participating in the snapshot.
|
complete breakdown of the current state for each shard participating in the snapshot.
|
||||||
|
|
Loading…
Reference in New Issue