recovery.asciidoc 6.8 KB

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