recovery.asciidoc 4.9 KB

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