recovery.asciidoc 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. [[cat-recovery-api-request]]
  9. ==== {api-request-title}
  10. `GET /_cat/recovery/<index>`
  11. `GET /_cat/recovery`
  12. [[cat-recovery-api-desc]]
  13. ==== {api-description-title}
  14. The cat recovery API returns information about shard recoveries, both
  15. ongoing and completed. It is a more compact view of the JSON
  16. <<indices-recovery,index recovery>> API.
  17. include::{es-repo-dir}/indices/recovery.asciidoc[tag=shard-recovery-desc]
  18. [[cat-recovery-path-params]]
  19. ==== {api-path-parms-title}
  20. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index]
  21. [[cat-recovery-query-params]]
  22. ==== {api-query-parms-title}
  23. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=active-only]
  24. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=bytes]
  25. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=detailed]
  26. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=http-format]
  27. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-h]
  28. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=help]
  29. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index-query-parm]
  30. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-s]
  31. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=time]
  32. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-v]
  33. [[cat-recovery-api-example]]
  34. ==== {api-examples-title}
  35. [[cat-recovery-api-ex-dead]]
  36. ===== Example with no ongoing recoveries
  37. [source,console]
  38. ----------------------------------------------------------------------------
  39. GET _cat/recovery?v
  40. ----------------------------------------------------------------------------
  41. // TEST[setup:twitter]
  42. The API returns the following response:
  43. [source,txt]
  44. ---------------------------------------------------------------------------
  45. 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
  46. twitter 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%
  47. ---------------------------------------------------------------------------
  48. // TESTRESPONSE[s/store/empty_store/]
  49. // TESTRESPONSE[s/100%/0.0%/]
  50. // TESTRESPONSE[s/9928b/0b/]
  51. // TESTRESPONSE[s/13ms/[0-9.]+m?s/]
  52. // TESTRESPONSE[s/13/\\d+/ non_json]
  53. In this example response, the source and target nodes are the same because the
  54. recovery type is `store`, meaning they were read from local storage on node
  55. start.
  56. [[cat-recovery-api-ex-live]]
  57. ===== Example with a live shard recovery
  58. By increasing the replica count of an index and bringing another node online to
  59. host the replicas, you can retrieve information about an ongoing recovery.
  60. [source,console]
  61. ----------------------------------------------------------------------------
  62. GET _cat/recovery?v&h=i,s,t,ty,st,shost,thost,f,fp,b,bp
  63. ----------------------------------------------------------------------------
  64. // TEST[setup:twitter]
  65. The API returns the following response:
  66. [source,txt]
  67. ----------------------------------------------------------------------------
  68. i s t ty st shost thost f fp b bp
  69. twitter 0 1252ms peer done 192.168.1.1 192.168.1.2 0 100.0% 0b 100.0%
  70. ----------------------------------------------------------------------------
  71. // TESTRESPONSE[s/peer/empty_store/]
  72. // TESTRESPONSE[s/192.168.1.2/127.0.0.1/]
  73. // TESTRESPONSE[s/192.168.1.1/n\/a/]
  74. // TESTRESPONSE[s/100.0%/0.0%/]
  75. // TESTRESPONSE[s/1252ms/[0-9.]+m?s/ non_json]
  76. In this example response, the recovery type is `peer`, meaning the shard
  77. recovered from another node. The returned files and bytes are real-time
  78. measurements.
  79. [[cat-recovery-api-ex-snapshot]]
  80. ===== Example with a snapshot recovery
  81. You can restore backups of an index using the <<modules-snapshots,snapshot and
  82. restore>> API. You can use the cat recovery API retrieve information about a
  83. snapshot recovery.
  84. [source,console]
  85. --------------------------------------------------------------------------------
  86. GET _cat/recovery?v&h=i,s,t,ty,st,rep,snap,f,fp,b,bp
  87. --------------------------------------------------------------------------------
  88. // TEST[skip:no need to execute snapshot/restore here]
  89. The API returns the following response with a recovery type of `snapshot`:
  90. [source,txt]
  91. --------------------------------------------------------------------------------
  92. i s t ty st rep snap f fp b bp
  93. twitter 0 1978ms snapshot done twitter snap_1 79 8.0% 12086 9.0%
  94. --------------------------------------------------------------------------------
  95. // TESTRESPONSE[non_json]