recovery.asciidoc 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. [[indices-recovery]]
  2. == Indices Recovery
  3. The indices recovery API provides insight into on-going index shard recoveries.
  4. Recovery status may be reported for specific indices, or cluster-wide.
  5. For example, the following command would show recovery information for the indices "index1" and "index2".
  6. [source,js]
  7. --------------------------------------------------
  8. GET index1,index2/_recovery?human
  9. --------------------------------------------------
  10. // CONSOLE
  11. // TEST[s/^/PUT index1\nPUT index2\n/]
  12. To see cluster-wide recovery status simply leave out the index names.
  13. [source,js]
  14. --------------------------------------------------
  15. GET /_recovery?human
  16. --------------------------------------------------
  17. // CONSOLE
  18. // TEST[s/^/PUT index1\n{"settings": {"index.number_of_shards": 1}}\n/]
  19. Response:
  20. [source,js]
  21. --------------------------------------------------
  22. {
  23. "index1" : {
  24. "shards" : [ {
  25. "id" : 0,
  26. "type" : "SNAPSHOT",
  27. "stage" : "INDEX",
  28. "primary" : true,
  29. "start_time" : "2014-02-24T12:15:59.716",
  30. "start_time_in_millis": 1393244159716,
  31. "total_time" : "2.9m",
  32. "total_time_in_millis" : 175576,
  33. "source" : {
  34. "repository" : "my_repository",
  35. "snapshot" : "my_snapshot",
  36. "index" : "index1"
  37. },
  38. "target" : {
  39. "id" : "ryqJ5lO5S4-lSFbGntkEkg",
  40. "hostname" : "my.fqdn",
  41. "ip" : "10.0.1.7",
  42. "name" : "my_es_node"
  43. },
  44. "index" : {
  45. "size" : {
  46. "total" : "75.4mb",
  47. "total_in_bytes" : 79063092,
  48. "reused" : "0b",
  49. "reused_in_bytes" : 0,
  50. "recovered" : "65.7mb",
  51. "recovered_in_bytes" : 68891939,
  52. "percent" : "87.1%"
  53. },
  54. "files" : {
  55. "total" : 73,
  56. "reused" : 0,
  57. "recovered" : 69,
  58. "percent" : "94.5%"
  59. },
  60. "total_time" : "0s",
  61. "total_time_in_millis" : 0
  62. },
  63. "translog" : {
  64. "recovered" : 0,
  65. "total" : 0,
  66. "percent" : "100.0%",
  67. "total_on_start" : 0,
  68. "total_time" : "0s",
  69. "total_time_in_millis" : 0,
  70. },
  71. "start" : {
  72. "check_index_time" : "0s",
  73. "check_index_time_in_millis" : 0,
  74. "total_time" : "0s",
  75. "total_time_in_millis" : 0
  76. }
  77. } ]
  78. }
  79. }
  80. --------------------------------------------------
  81. // We should really assert that this is up to date but that is hard!
  82. The above response shows a single index recovering a single shard. In this case, the source of the recovery is a snapshot repository
  83. and the target of the recovery is the node with name "my_es_node".
  84. Additionally, the output shows the number and percent of files recovered, as well as the number and percent of bytes recovered.
  85. In some cases a higher level of detail may be preferable. Setting "detailed=true" will present a list of physical files in recovery.
  86. [source,js]
  87. --------------------------------------------------
  88. GET _recovery?human&detailed=true
  89. --------------------------------------------------
  90. Response:
  91. [source,js]
  92. --------------------------------------------------
  93. {
  94. "index1" : {
  95. "shards" : [ {
  96. "id" : 0,
  97. "type" : "STORE",
  98. "stage" : "DONE",
  99. "primary" : true,
  100. "start_time" : "2014-02-24T12:38:06.349",
  101. "start_time_in_millis" : "1393245486349",
  102. "stop_time" : "2014-02-24T12:38:08.464",
  103. "stop_time_in_millis" : "1393245488464",
  104. "total_time" : "2.1s",
  105. "total_time_in_millis" : 2115,
  106. "source" : {
  107. "id" : "RGMdRc-yQWWKIBM4DGvwqQ",
  108. "hostname" : "my.fqdn",
  109. "ip" : "10.0.1.7",
  110. "name" : "my_es_node"
  111. },
  112. "target" : {
  113. "id" : "RGMdRc-yQWWKIBM4DGvwqQ",
  114. "hostname" : "my.fqdn",
  115. "ip" : "10.0.1.7",
  116. "name" : "my_es_node"
  117. },
  118. "index" : {
  119. "size" : {
  120. "total" : "24.7mb",
  121. "total_in_bytes" : 26001617,
  122. "reused" : "24.7mb",
  123. "reused_in_bytes" : 26001617,
  124. "recovered" : "0b",
  125. "recovered_in_bytes" : 0,
  126. "percent" : "100.0%"
  127. },
  128. "files" : {
  129. "total" : 26,
  130. "reused" : 26,
  131. "recovered" : 0,
  132. "percent" : "100.0%",
  133. "details" : [ {
  134. "name" : "segments.gen",
  135. "length" : 20,
  136. "recovered" : 20
  137. }, {
  138. "name" : "_0.cfs",
  139. "length" : 135306,
  140. "recovered" : 135306
  141. }, {
  142. "name" : "segments_2",
  143. "length" : 251,
  144. "recovered" : 251
  145. },
  146. ...
  147. ]
  148. },
  149. "total_time" : "2ms",
  150. "total_time_in_millis" : 2
  151. },
  152. "translog" : {
  153. "recovered" : 71,
  154. "total_time" : "2.0s",
  155. "total_time_in_millis" : 2025
  156. },
  157. "start" : {
  158. "check_index_time" : 0,
  159. "total_time" : "88ms",
  160. "total_time_in_millis" : 88
  161. }
  162. } ]
  163. }
  164. }
  165. --------------------------------------------------
  166. // We should really assert that this is up to date but that is hard!
  167. This response shows a detailed listing (truncated for brevity) of the actual files recovered and their sizes.
  168. Also shown are the timings in milliseconds of the various stages of recovery: index retrieval, translog replay, and index start time.
  169. Note that the above listing indicates that the recovery is in stage "done". All recoveries, whether on-going or complete, are kept in
  170. cluster state and may be reported on at any time. Setting "active_only=true" will cause only on-going recoveries to be reported.
  171. Here is a complete list of options:
  172. [horizontal]
  173. `detailed`:: Display a detailed view. This is primarily useful for viewing the recovery of physical index files. Default: false.
  174. `active_only`:: Display only those recoveries that are currently on-going. Default: false.
  175. Description of output fields:
  176. [horizontal]
  177. `id`:: Shard ID
  178. `type`:: Recovery type:
  179. * store
  180. * snapshot
  181. * replica
  182. * relocating
  183. `stage`:: Recovery stage:
  184. * init: Recovery has not started
  185. * index: Reading index meta-data and copying bytes from source to destination
  186. * start: Starting the engine; opening the index for use
  187. * translog: Replaying transaction log
  188. * finalize: Cleanup
  189. * done: Complete
  190. `primary`:: True if shard is primary, false otherwise
  191. `start_time`:: Timestamp of recovery start
  192. `stop_time`:: Timestamp of recovery finish
  193. `total_time_in_millis`:: Total time to recover shard in milliseconds
  194. `source`:: Recovery source:
  195. * repository description if recovery is from a snapshot
  196. * description of source node otherwise
  197. `target`:: Destination node
  198. `index`:: Statistics about physical index recovery
  199. `translog`:: Statistics about translog recovery
  200. `start`:: Statistics about time to open and start the index