corrupt-repository.asciidoc 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. // tag::cloud[]
  2. Fixing the corrupted repository will entail making changes in multiple deployments
  3. that write to the same snapshot repository.
  4. Only one deployment must be writing to a repository. The deployment
  5. that will keep writing to the repository will be called the "primary" deployment (the current cluster),
  6. and the other one(s) where we'll mark the repository read-only as the "secondary"
  7. deployments.
  8. First mark the repository as read-only on the secondary deployments:
  9. **Use {kib}**
  10. //tag::kibana-api-ex[]
  11. . Log in to the {ess-console}[{ecloud} console].
  12. +
  13. . On the **Elasticsearch Service** panel, click the name of your deployment.
  14. +
  15. NOTE:
  16. If the name of your deployment is disabled your {kib} instances might be
  17. unhealthy, in which case please contact https://support.elastic.co[Elastic Support].
  18. If your deployment doesn't include {kib}, all you need to do is
  19. {cloud}/ec-access-kibana.html[enable it first].
  20. . Open your deployment's side navigation menu (placed under the Elastic logo in the upper left corner)
  21. and go to **Stack Management > Snapshot and Restore > Repositories**.
  22. +
  23. [role="screenshot"]
  24. image::images/repositories.png[{kib} Console,align="center"]
  25. . The repositories table should now be visible. Click on the pencil icon at the
  26. right side of the repository to be marked as read-only. On the Edit page that opened
  27. scroll down and check "Read-only repository". Click "Save".
  28. Alternatively if deleting the repository altogether is preferable, select the checkbox
  29. at the left of the repository name in the repositories table and click the
  30. "Remove repository" red button at the top left of the table.
  31. At this point, it's only the primary (current) deployment that has the repository marked
  32. as writeable.
  33. {es} sees it as corrupt, so the repository needs to be removed and added back so that
  34. {es} can resume using it:
  35. Note that we're now configuring the primary (current) deployment.
  36. . Open the primary deployment's side navigation menu (placed under the Elastic logo in the upper left corner)
  37. and go to **Stack Management > Snapshot and Restore > Repositories**.
  38. +
  39. [role="screenshot"]
  40. image::images/repositories.png[{kib} Console,align="center"]
  41. . Get the details for the repository we'll recreate later by clicking on the repository
  42. name in the repositories table and making note of all the repository configurations
  43. that are displayed on the repository details page (we'll use them when we recreate
  44. the repository). Close the details page using the link at
  45. the bottom left of the page.
  46. +
  47. [role="screenshot"]
  48. image::images/repo_details.png[{kib} Console,align="center"]
  49. . With all the details above noted, next delete the repository. Select the
  50. checkbox at the left of the repository and hit the "Remove repository" red button
  51. at the top left of the page.
  52. . Recreate the repository by clicking the "Register Repository" button
  53. at the top right corner of the repositories table.
  54. +
  55. [role="screenshot"]
  56. image::images/register_repo.png[{kib} Console,align="center"]
  57. . Fill in the repository name, select the type and click "Next".
  58. +
  59. [role="screenshot"]
  60. image::images/register_repo_details.png[{kib} Console,align="center"]
  61. . Fill in the repository details (client, bucket, base path etc) with the values
  62. you noted down before deleting the repository and click the "Register" button
  63. at the bottom.
  64. . Select "Verify repository" to confirm that your settings are correct and the
  65. deployment can connect to your repository.
  66. //end::kibana-api-ex[]
  67. // end::cloud[]
  68. // tag::self-managed[]
  69. Fixing the corrupted repository will entail making changes in multiple clusters
  70. that write to the same snapshot repository.
  71. Only one cluster must be writing to a repository. Let's call the cluster
  72. we want to keep writing to the repository the "primary" cluster (the current cluster),
  73. and the other one(s) where we'll mark the repository as read-only the "secondary"
  74. clusters.
  75. Let's first work on the secondary clusters:
  76. . Get the configuration of the repository:
  77. +
  78. [source,console]
  79. ----
  80. GET _snapshot/my-repo
  81. ----
  82. // TEST[skip:we're not setting up repos in these tests]
  83. +
  84. The reponse will look like this:
  85. +
  86. [source,console-result]
  87. ----
  88. {
  89. "my-repo": { <1>
  90. "type": "s3",
  91. "settings": {
  92. "bucket": "repo-bucket",
  93. "client": "elastic-internal-71bcd3",
  94. "base_path": "myrepo"
  95. }
  96. }
  97. }
  98. ----
  99. // TESTRESPONSE[skip:the result is for illustrating purposes only]
  100. +
  101. <1> Represents the current configuration for the repository.
  102. . Using the settings retrieved above, add the `readonly: true` option to mark
  103. it as read-only:
  104. +
  105. [source,console]
  106. ----
  107. PUT _snapshot/my-repo
  108. {
  109. "type": "s3",
  110. "settings": {
  111. "bucket": "repo-bucket",
  112. "client": "elastic-internal-71bcd3",
  113. "base_path": "myrepo",
  114. "readonly": true <1>
  115. }
  116. }
  117. ----
  118. // TEST[skip:we're not setting up repos in these tests]
  119. +
  120. <1> Marks the repository as read-only.
  121. . Alternatively, deleting the repository is an option using:
  122. +
  123. [source,console]
  124. ----
  125. DELETE _snapshot/my-repo
  126. ----
  127. // TEST[skip:we're not setting up repos in these tests]
  128. +
  129. The response will look like this:
  130. +
  131. [source,console-result]
  132. ------------------------------------------------------------------------------
  133. {
  134. "acknowledged": true
  135. }
  136. ------------------------------------------------------------------------------
  137. // TESTRESPONSE[skip:the result is for illustrating purposes only]
  138. At this point, it's only the primary (current) cluster that has the repository marked
  139. as writeable.
  140. {es} sees it as corrupt though so let's remove the repository and recreate it so that
  141. {es} can resume using it:
  142. Note that now we're configuring the primary (current) cluster.
  143. . Get the configuration of the repository and save its configuration as we'll use it
  144. to recreate the repository:
  145. +
  146. [source,console]
  147. ----
  148. GET _snapshot/my-repo
  149. ----
  150. // TEST[skip:we're not setting up repos in these tests]
  151. . Delete the repository:
  152. +
  153. [source,console]
  154. ----
  155. DELETE _snapshot/my-repo
  156. ----
  157. // TEST[skip:we're not setting up repos in these tests]
  158. +
  159. The response will look like this:
  160. +
  161. [source,console-result]
  162. ------------------------------------------------------------------------------
  163. {
  164. "acknowledged": true
  165. }
  166. ------------------------------------------------------------------------------
  167. // TESTRESPONSE[skip:the result is for illustrating purposes only]
  168. . Using the configuration we obtained above, let's recreate the repository:
  169. +
  170. [source,console]
  171. ----
  172. PUT _snapshot/my-repo
  173. {
  174. "type": "s3",
  175. "settings": {
  176. "bucket": "repo-bucket",
  177. "client": "elastic-internal-71bcd3",
  178. "base_path": "myrepo"
  179. }
  180. }
  181. ----
  182. // TEST[skip:we're not setting up repos in these tests]
  183. +
  184. The response will look like this:
  185. +
  186. [source,console-result]
  187. ------------------------------------------------------------------------------
  188. {
  189. "acknowledged": true
  190. }
  191. ------------------------------------------------------------------------------
  192. // TESTRESPONSE[skip:the result is for illustrating purposes only]
  193. // end::self-managed[]