monitor-snapshot-restore.asciidoc 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. [[snapshots-monitor-snapshot-restore]]
  2. == Monitor snapshot and restore progress
  3. ++++
  4. <titleabbrev>Monitor snapshot and restore</titleabbrev>
  5. ++++
  6. There are several ways to monitor the progress of the snapshot and restore processes while they are running. Both
  7. operations support `wait_for_completion` parameter that would block client until the operation is completed. This is
  8. the simplest method that can be used to get notified 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_backup/snapshot_1?wait_for_completion=true
  20. -----------------------------------
  21. // TESTSETUP
  22. ////
  23. The snapshot operation can be also monitored by periodic calls to the snapshot info:
  24. [source,console]
  25. -----------------------------------
  26. GET /_snapshot/my_backup/snapshot_1
  27. -----------------------------------
  28. Please note that snapshot info operation uses the same resources and thread pool as the snapshot operation. So,
  29. executing a snapshot info operation while large shards are being snapshotted can cause the snapshot info operation to wait
  30. for available resources before returning the result. On very large shards the wait time can be significant.
  31. To get more immediate and complete information about snapshots the snapshot status command can be used instead:
  32. [source,console]
  33. -----------------------------------
  34. GET /_snapshot/my_backup/snapshot_1/_status
  35. -----------------------------------
  36. // TEST[continued]
  37. While snapshot info method returns only basic information about the snapshot in progress, the snapshot status returns
  38. complete breakdown of the current state for each shard participating in the snapshot.
  39. The restore process piggybacks on the standard recovery mechanism of the Elasticsearch. As a result, standard recovery
  40. monitoring services can be used to monitor the state of restore. When restore operation is executed the cluster
  41. typically goes into `red` state. It happens because the restore operation starts with "recovering" primary shards of the
  42. restored indices. During this operation the primary shards become unavailable which manifests itself in the `red` cluster
  43. state. Once recovery of primary shards is completed Elasticsearch is switching to standard replication process that
  44. creates the required number of replicas at this moment cluster switches to the `yellow` state. Once all required replicas
  45. are created, the cluster switches to the `green` states.
  46. The cluster health operation provides only a high level status of the restore process. It's possible to get more
  47. detailed insight into the current state of the recovery process by using <<indices-recovery, index recovery>> and
  48. <<cat-recovery, cat recovery>> APIs.
  49. [float]
  50. === Stop snapshot and restore operations
  51. The snapshot and restore framework allows running only one snapshot or one restore operation at a time. If a currently
  52. running snapshot was executed by mistake, or takes unusually long, it can be terminated using the snapshot delete operation.
  53. The snapshot delete operation checks if the deleted snapshot is currently running and if it does, the delete operation stops
  54. that snapshot before deleting the snapshot data from the repository.
  55. [source,console]
  56. -----------------------------------
  57. DELETE /_snapshot/my_backup/snapshot_1
  58. -----------------------------------
  59. // TEST[continued]
  60. The restore operation uses the standard shard recovery mechanism. Therefore, any currently running restore operation can
  61. be canceled by deleting indices that are being restored. Please note that data for all deleted indices will be removed
  62. from the cluster as a result of this operation.
  63. [float]
  64. === Effect of cluster blocks on snapshot and restore
  65. Many snapshot and restore operations are affected by cluster and index blocks. For example, registering and unregistering
  66. repositories require write global metadata access. The snapshot operation requires that all indices and their metadata as
  67. well as the global metadata were readable. The restore operation requires the global metadata to be writable, however
  68. the index level blocks are ignored during restore because indices are essentially recreated during restore.
  69. Please note that a repository content is not part of the cluster and therefore cluster blocks don't affect internal
  70. repository operations such as listing or deleting snapshots from an already registered repository.