verify-repo-integrity-api.asciidoc 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. [role="xpack"]
  2. [[verify-repo-integrity-api]]
  3. === Verify repository integrity API
  4. ++++
  5. <titleabbrev>Verify repository integrity</titleabbrev>
  6. ++++
  7. .New API reference
  8. [sidebar]
  9. --
  10. For the most up-to-date API details, refer to {api-es}/group/endpoint-snapshot[Snapshot and restore APIs].
  11. --
  12. Verifies the integrity of the contents of a snapshot repository.
  13. ////
  14. [source,console]
  15. ----
  16. PUT /_snapshot/my_repository
  17. {
  18. "type": "fs",
  19. "settings": {
  20. "location": "my_backup_location"
  21. }
  22. }
  23. ----
  24. // TESTSETUP
  25. ////
  26. [source,console]
  27. ----
  28. POST /_snapshot/my_repository/_verify_integrity
  29. ----
  30. [[verify-repo-integrity-api-request]]
  31. ==== {api-request-title}
  32. `POST /_snapshot/<repository>/_verify_integrity`
  33. [[verify-repo-integrity-api-prereqs]]
  34. ==== {api-prereq-title}
  35. * If the {es} {security-features} are enabled, you must have the `manage`
  36. <<privileges-list-cluster,cluster privilege>> to use this API. For more
  37. information, see <<security-privileges>>.
  38. [[verify-repo-integrity-api-desc]]
  39. ==== {api-description-title}
  40. This API allows you to perform a comprehensive check of the contents of a
  41. repository, looking for any anomalies in its data or metadata which might
  42. prevent you from restoring snapshots from the repository or which might cause
  43. future snapshot create or delete operations to fail.
  44. If you suspect the integrity of the contents of one of your snapshot
  45. repositories, cease all write activity to this repository immediately, set its
  46. `read_only` option to `true`, and use this API to verify its integrity. Until
  47. you do so:
  48. * It may not be possible to <<snapshots-restore-snapshot,restore some
  49. snapshots>> from this repository.
  50. * <<searchable-snapshots>> may report errors when searched, or may have
  51. unassigned shards.
  52. * <<snapshots-take-snapshot,Taking snapshots>> into this repository may fail,
  53. or may appear to succeed having created a snapshot which cannot be restored.
  54. * <<delete-snapshot-api,Deleting snapshots>> from this repository may fail, or
  55. may appear to succeed leaving the underlying data on disk.
  56. * Continuing to write to the repository while it is in an invalid state may
  57. causing additional damage to its contents.
  58. If the <<verify-repo-integrity-api>> API finds any problems with the integrity
  59. of the contents of your repository, {es} will not be able to repair the damage.
  60. The only way to bring the repository back into a fully working state after its
  61. contents have been damaged is by restoring its contents from a
  62. <<snapshots-repository-backup,repository backup>> which was taken before the
  63. damage occurred. You must also identify what caused the damage and take action
  64. to prevent it from happening again.
  65. If you cannot restore a repository backup,
  66. <<snapshots-register-repository,register a new repository>> and use this for
  67. all future snapshot operations. In some cases it may be possible to recover
  68. some of the contents of a damaged repository, either by
  69. <<snapshots-restore-snapshot,restoring>> as many of its snapshots as needed and
  70. <<snapshots-take-snapshot,taking new snapshots>> of the restored data, or by
  71. using the <<docs-reindex>> API to copy data from any <<searchable-snapshots>>
  72. mounted from the damaged repository.
  73. Avoid all operations which write to the repository while the
  74. <<verify-repo-integrity-api>> API is running. If something changes the
  75. repository contents while an integrity verification is running then {es} may
  76. incorrectly report having detected some anomalies in its contents due to the
  77. concurrent writes. It may also incorrectly fail to report some anomalies that
  78. the concurrent writes prevented it from detecting.
  79. NOTE: This API is intended for exploratory use by humans. You should expect the
  80. request parameters and the response format to vary in future versions.
  81. NOTE: This API may not work correctly in a mixed-version cluster.
  82. [[verify-repo-integrity-api-path-params]]
  83. ==== {api-path-parms-title}
  84. `<repository>`::
  85. (Required, string)
  86. Name of the snapshot repository whose integrity to verify.
  87. [[verify-repo-integrity-api-query-params]]
  88. ==== {api-query-parms-title}
  89. The default values for the parameters of this API are designed to limit the
  90. impact of the integrity verification on other activities in your cluster. For
  91. instance, by default it will only use at most half of the `snapshot_meta`
  92. threads to verify the integrity of each snapshot, allowing other snapshot
  93. operations to use the other half of this thread pool.
  94. If you modify these parameters to speed up the verification process, you risk
  95. disrupting other snapshot-related operations in your cluster. For large
  96. repositories, consider setting up a separate single-node {es} cluster just for
  97. running the integrity verification API.
  98. `snapshot_verification_concurrency`::
  99. (Optional, integer) Specifies the number of snapshots to verify concurrently.
  100. Defaults to `0` which means to use at most half of the `snapshot_meta` thread
  101. pool at once.
  102. `index_verification_concurrency`::
  103. (Optional, integer) Specifies the number of indices to verify concurrently.
  104. Defaults to `0` which means to use the entire `snapshot_meta` thread pool.
  105. `meta_thread_pool_concurrency`::
  106. (Optional, integer) Specifies the maximum number of snapshot metadata
  107. operations to execute concurrently. Defaults to `0` which means to use at most
  108. half of the `snapshot_meta` thread pool at once.
  109. `index_snapshot_verification_concurrency`::
  110. (Optional, integer) Specifies the maximum number of index snapshots to verify
  111. concurrently within each index verification. Defaults to `1`.
  112. `max_failed_shard_snapshots`::
  113. (Optional, integer) Limits the number of shard snapshot failures to track
  114. during integrity verification, in order to avoid excessive resource usage. If
  115. your repository contains more than this number of shard snapshot failures then
  116. the verification will fail. Defaults to `10000`.
  117. `verify_blob_contents`::
  118. (Optional, boolean) Specifies whether to verify the checksum of every data blob
  119. in the repository. Defaults to `false`. If this feature is enabled, {es} will
  120. read the entire repository contents, which may be extremely slow and expensive.
  121. `blob_thread_pool_concurrency`::
  122. (Optional, integer) If `?verify_blob_contents` is `true`, this parameter
  123. specifies how many blobs to verify at once. Defaults to `1`.
  124. `max_bytes_per_sec`::
  125. (Optional, <<size-units, size units>>)
  126. If `?verify_blob_contents` is `true`, this parameter specifies the maximum
  127. amount of data that {es} will read from the repository every second. Defaults
  128. to `10mb`.
  129. [role="child_attributes"]
  130. [[verify-repo-integrity-api-response-body]]
  131. ==== {api-response-body-title}
  132. The response exposes implementation details of the analysis which may change
  133. from version to version. The response body format is therefore not considered
  134. stable and may be different in newer versions.
  135. `log`::
  136. (array) A sequence of objects that report the progress of the analysis.
  137. +
  138. .Properties of `log`
  139. [%collapsible%open]
  140. ====
  141. `timestamp_in_millis`::
  142. (integer) The timestamp of this log entry, represented as the number of
  143. milliseconds since the {wikipedia}/Unix_time[Unix epoch].
  144. `timestamp`::
  145. (string) The timestamp of this log entry, represented as a string formatted
  146. according to {wikipedia}/ISO_8601[ISO 8601]. Only included if the
  147. <<common-options,`?human`>> flag is set.
  148. `snapshot`::
  149. (object) If the log entry pertains to a particular snapshot then the snapshot
  150. will be described in this object.
  151. `index`::
  152. (object) If the log entry pertains to a particular index then the index will be
  153. described in this object.
  154. `snapshot_restorability`::
  155. (object) If the log entry pertains to the restorability of an index then the
  156. details will be described in this object.
  157. `anomaly`::
  158. (string) If the log entry pertains to an anomaly in the repository contents then
  159. this string will describe the anomaly.
  160. `exception`::
  161. (object) If the log entry pertains to an exception that {es} encountered during
  162. the verification then the details will be included in this object.
  163. ====
  164. `results`::
  165. (object) An object which describes the final results of the analysis.
  166. +
  167. .Properties of `results`
  168. [%collapsible%open]
  169. ====
  170. `status`::
  171. (object) The final status of the analysis task.
  172. `final_repository_generation`::
  173. (integer) The repository generation at the end of the analysis. If there were
  174. any writes to the repository during the analysis then this value will be
  175. different from the `generation` reported in the task status, and the analysis
  176. may have detected spurious anomalies due to the concurrent writes, or may even
  177. have failed to detect some anomalies in the repository contents.
  178. `total_anomalies`::
  179. (integer) The total number of anomalies detected during the analysis.
  180. `result`::
  181. (string) The final result of the analysis. If the repository contents appear to
  182. be intact then this will be the string `pass`. If this field is missing, or
  183. contains some other value, then the repository contents were not fully
  184. verified.
  185. ====
  186. `exception`::
  187. (object) If the analysis encountered an exception which prevented it from
  188. completing successfully then this exception will be reported here.