recovery.asciidoc 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. [[cat-recovery]]
  2. === cat recovery API
  3. ++++
  4. <titleabbrev>cat recovery</titleabbrev>
  5. ++++
  6. Returns information about ongoing and completed shard recoveries,
  7. similar to the <<indices-recovery, index recovery>> API.
  8. For data streams, the API returns information about the stream's backing
  9. indices.
  10. [[cat-recovery-api-request]]
  11. ==== {api-request-title}
  12. `GET /_cat/recovery/<target>`
  13. `GET /_cat/recovery`
  14. [[cat-recovery-api-desc]]
  15. ==== {api-description-title}
  16. The cat recovery API returns information about shard recoveries, both
  17. ongoing and completed. It is a more compact view of the JSON
  18. <<indices-recovery,index recovery>> API.
  19. include::{es-repo-dir}/indices/recovery.asciidoc[tag=shard-recovery-desc]
  20. [[cat-recovery-path-params]]
  21. ==== {api-path-parms-title}
  22. `<target>`::
  23. (Optional, string)
  24. Comma-separated list of data streams, indices, and index aliases used to limit
  25. the request. Wildcard expressions (`*`) are supported.
  26. +
  27. To target all data streams and indices in a cluster, omit this parameter or use
  28. `_all` or `*`.
  29. [[cat-recovery-query-params]]
  30. ==== {api-query-parms-title}
  31. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=active-only]
  32. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=bytes]
  33. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=detailed]
  34. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=http-format]
  35. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-h]
  36. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=help]
  37. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index-query-parm]
  38. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-s]
  39. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=time]
  40. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-v]
  41. [[cat-recovery-api-example]]
  42. ==== {api-examples-title}
  43. [[cat-recovery-api-ex-dead]]
  44. ===== Example with no ongoing recoveries
  45. [source,console]
  46. ----------------------------------------------------------------------------
  47. GET _cat/recovery?v
  48. ----------------------------------------------------------------------------
  49. // TEST[setup:my_index]
  50. The API returns the following response:
  51. [source,txt]
  52. ---------------------------------------------------------------------------
  53. index shard time type stage source_host source_node target_host target_node repository snapshot files files_recovered files_percent files_total bytes bytes_recovered bytes_percent bytes_total translog_ops translog_ops_recovered translog_ops_percent
  54. my-index-000001 0 13ms store done n/a n/a 127.0.0.1 node-0 n/a n/a 0 0 100% 13 0b 0b 100% 9928b 0 0 100.0%
  55. ---------------------------------------------------------------------------
  56. // TESTRESPONSE[s/store/empty_store/]
  57. // TESTRESPONSE[s/100%/0.0%/]
  58. // TESTRESPONSE[s/9928b/0b/]
  59. // TESTRESPONSE[s/13ms/[0-9.]+m?s/]
  60. // TESTRESPONSE[s/13/\\d+/ non_json]
  61. In this example response, the source and target nodes are the same because the
  62. recovery type is `store`, meaning they were read from local storage on node
  63. start.
  64. [[cat-recovery-api-ex-live]]
  65. ===== Example with a live shard recovery
  66. By increasing the replica count of an index and bringing another node online to
  67. host the replicas, you can retrieve information about an ongoing recovery.
  68. [source,console]
  69. ----------------------------------------------------------------------------
  70. GET _cat/recovery?v&h=i,s,t,ty,st,shost,thost,f,fp,b,bp
  71. ----------------------------------------------------------------------------
  72. // TEST[setup:my_index]
  73. The API returns the following response:
  74. [source,txt]
  75. ----------------------------------------------------------------------------
  76. i s t ty st shost thost f fp b bp
  77. my-index-000001 0 1252ms peer done 192.168.1.1 192.168.1.2 0 100.0% 0b 100.0%
  78. ----------------------------------------------------------------------------
  79. // TESTRESPONSE[s/peer/empty_store/]
  80. // TESTRESPONSE[s/192.168.1.2/127.0.0.1/]
  81. // TESTRESPONSE[s/192.168.1.1/n\/a/]
  82. // TESTRESPONSE[s/100.0%/0.0%/]
  83. // TESTRESPONSE[s/1252ms/[0-9.]+m?s/ non_json]
  84. In this example response, the recovery type is `peer`, meaning the shard
  85. recovered from another node. The returned files and bytes are real-time
  86. measurements.
  87. [[cat-recovery-api-ex-snapshot]]
  88. ===== Example with a snapshot recovery
  89. You can restore backups of an index using the <<modules-snapshots,snapshot and
  90. restore>> API. You can use the cat recovery API retrieve information about a
  91. snapshot recovery.
  92. [source,console]
  93. --------------------------------------------------------------------------------
  94. GET _cat/recovery?v&h=i,s,t,ty,st,rep,snap,f,fp,b,bp
  95. --------------------------------------------------------------------------------
  96. // TEST[skip:no need to execute snapshot/restore here]
  97. The API returns the following response with a recovery type of `snapshot`:
  98. [source,txt]
  99. --------------------------------------------------------------------------------
  100. i s t ty st rep snap f fp b bp
  101. my-index-000001 0 1978ms snapshot done my-repo snap-1 79 8.0% 12086 9.0%
  102. --------------------------------------------------------------------------------
  103. // TESTRESPONSE[non_json]