monitor-snapshot-restore.asciidoc 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. [[snapshots-monitor-snapshot-restore]]
  2. == Monitor snapshot progress
  3. Use the <<get-snapshot-api,get snapshot API>> or the
  4. <<get-snapshot-status-api,get snapshot status API>> to monitor the
  5. progress of snapshot operations. Both APIs support the
  6. `wait_for_completion` parameter that blocks the client until the
  7. operation finishes, which is the simplest method of being notified
  8. about operation completion.
  9. ////
  10. [source,console]
  11. -----------------------------------
  12. PUT /_snapshot/my_backup
  13. {
  14. "type": "fs",
  15. "settings": {
  16. "location": "my_backup_location"
  17. }
  18. }
  19. PUT /_snapshot/my_fs_backup
  20. {
  21. "type": "fs",
  22. "settings": {
  23. "location": "my_other_backup_location"
  24. }
  25. }
  26. PUT /_snapshot/my_backup/snapshot_1?wait_for_completion=true
  27. PUT /_snapshot/my_backup/some_other_snapshot?wait_for_completion=true
  28. -----------------------------------
  29. // TESTSETUP
  30. ////
  31. Use the `_current` parameter to retrieve all currently running
  32. snapshots in the cluster:
  33. [source,console]
  34. -----------------------------------
  35. GET /_snapshot/my_backup/_current
  36. -----------------------------------
  37. Including a snapshot name in the request retrieves information about a single snapshot:
  38. [source,console]
  39. -----------------------------------
  40. GET /_snapshot/my_backup/snapshot_1
  41. -----------------------------------
  42. This request retrieves basic information about the snapshot, including start and end time, version of
  43. {es} that created the snapshot, the list of included data streams and indices, the current state of the
  44. snapshot and the list of failures that occurred during the snapshot.
  45. Similar to repositories, you can retrieve information about multiple snapshots in a single request, and wildcards are supported:
  46. [source,console]
  47. -----------------------------------
  48. GET /_snapshot/my_backup/snapshot_*,some_other_snapshot
  49. -----------------------------------
  50. Separate repository names with commas or use wildcards to retrieve snapshots from multiple repositories:
  51. [source,console]
  52. -----------------------------------
  53. GET /_snapshot/_all
  54. GET /_snapshot/my_backup,my_fs_backup
  55. GET /_snapshot/my*/snap*
  56. -----------------------------------
  57. Add the `_all` parameter to the request to list all snapshots currently stored in the repository:
  58. [source,console]
  59. -----------------------------------
  60. GET /_snapshot/my_backup/_all
  61. -----------------------------------
  62. This request fails if some of the snapshots are unavailable. Use the boolean parameter `ignore_unavailable` to
  63. return all snapshots that are currently available.
  64. Getting all snapshots in the repository can be costly on cloud-based repositories,
  65. both from a cost and performance perspective. If the only information required is
  66. the snapshot names or UUIDs in the repository and the data streams and indices in each snapshot, then
  67. the optional boolean parameter `verbose` can be set to `false` to execute a more
  68. performant and cost-effective retrieval of the snapshots in the repository.
  69. NOTE: Setting `verbose` to `false` omits additional information
  70. about the snapshot, such as metadata, start and end time, number of shards that include the snapshot, and error messages. The default value of the `verbose` parameter is `true`.
  71. [discrete]
  72. [[get-snapshot-detailed-status]]
  73. === Retrieving snapshot status
  74. To retrieve more detailed information about snapshots, use the <<get-snapshot-status-api,get snapshot status API>>. While snapshot request returns only basic information about the snapshot in progress, the snapshot status request returns
  75. complete breakdown of the current state for each shard participating in the snapshot.
  76. // tag::get-snapshot-status-warning[]
  77. [WARNING]
  78. ====
  79. Using the get snapshot status API to return any status results other than the currently running snapshots (`_current`) can be very expensive. Each request to retrieve snapshot status results in file reads from every shard in a snapshot, for each snapshot. Such requests are taxing to machine resources and can also incur high processing costs when running in the cloud.
  80. For example, if you have 100 snapshots with 1,000 shards each, the API request will result in 100,000 file reads (100 snapshots * 1,000 shards). Depending on the latency of your file storage, the request can take extremely long to retrieve results.
  81. ====
  82. // end::get-snapshot-status-warning[]
  83. The following request retrieves all currently running snapshots with
  84. detailed status information:
  85. [source,console]
  86. -----------------------------------
  87. GET /_snapshot/_status
  88. -----------------------------------
  89. By specifying a repository name, it's possible
  90. to limit the results to a particular repository:
  91. [source,console]
  92. -----------------------------------
  93. GET /_snapshot/my_backup/_status
  94. -----------------------------------
  95. If both repository name and snapshot name are specified, the request
  96. returns detailed status information for the given snapshot, even
  97. if not currently running:
  98. [source,console]
  99. -----------------------------------
  100. GET /_snapshot/my_backup/snapshot_1/_status
  101. -----------------------------------
  102. [discrete]
  103. [[get-snapshot-stop-snapshot]]
  104. === Stop snapshot operations
  105. To stop a currently running snapshot that was started by mistake or is taking unusually long, use
  106. the <<delete-snapshot-api,delete snapshot API>>.
  107. This operation checks whether the deleted snapshot is currently running. If it is, the delete snapshot operation stops
  108. that snapshot before deleting the snapshot data from the repository.
  109. [source,console]
  110. -----------------------------------
  111. DELETE /_snapshot/my_backup/snapshot_1
  112. -----------------------------------
  113. [discrete]
  114. [[get-snapshot-cluster-blocks]]
  115. === Effect of cluster blocks on snapshot and restore
  116. Many snapshot and restore operations are affected by cluster and index blocks. For example, registering and unregistering
  117. repositories require global metadata write access. The snapshot operation requires that all indices, backing indices, and their metadata (including
  118. global metadata) are readable. The restore operation requires the global metadata to be writable. However,
  119. the index level blocks are ignored during restore because indices are essentially recreated during restore.
  120. A repository content is not part of the cluster and therefore cluster blocks do not affect internal
  121. repository operations such as listing or deleting snapshots from an already registered repository.