recovery.asciidoc 5.2 KB

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