corrupt-repository.asciidoc 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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: If the name of your deployment is disabled your {kib} instances might be
  16. unhealthy, in which case please contact https://support.elastic.co[Elastic Support].
  17. If your deployment doesn't include {kib}, all you need to do is
  18. {cloud}/ec-access-kibana.html[enable it first].
  19. . Open your deployment's side navigation menu (placed under the Elastic logo in the upper left corner)
  20. and go to **Stack Management > Snapshot and Restore > Repositories**.
  21. +
  22. [role="screenshot"]
  23. image::images/repositories.png[{kib} Console,align="center"]
  24. . The repositories table should now be visible. Click on the pencil icon at the
  25. right side of the repository to be marked as read-only. On the Edit page that opened
  26. scroll down and check "Read-only repository". Click "Save".
  27. Alternatively if deleting the repository altogether is preferable, select the checkbox
  28. at the left of the repository name in the repositories table and click the
  29. "Remove repository" red button at the top left of the table.
  30. At this point, it's only the primary (current) deployment that has the repository marked
  31. as writeable.
  32. {es} sees it as corrupt, so the repository needs to be removed and added back so that
  33. {es} can resume using it:
  34. Note that we're now configuring the primary (current) deployment.
  35. . Open the primary deployment's side navigation menu (placed under the Elastic logo in the upper left corner)
  36. and go to **Stack Management > Snapshot and Restore > Repositories**.
  37. +
  38. [role="screenshot"]
  39. image::images/repositories.png[{kib} Console,align="center"]
  40. . Click on the pencil icon at the right side of the repository. On the Edit page that opened
  41. scroll down and click "Save", without making any changes to the existing settings.
  42. //end::kibana-api-ex[]
  43. // end::cloud[]
  44. // tag::self-managed[]
  45. Fixing the corrupted repository will entail making changes in multiple clusters
  46. that write to the same snapshot repository.
  47. Only one cluster must be writing to a repository. Let's call the cluster
  48. we want to keep writing to the repository the "primary" cluster (the current cluster),
  49. and the other one(s) where we'll mark the repository as read-only the "secondary"
  50. clusters.
  51. Let's first work on the secondary clusters:
  52. . Get the configuration of the repository:
  53. +
  54. [source,console]
  55. ----
  56. GET _snapshot/my-repo
  57. ----
  58. // TEST[skip:we're not setting up repos in these tests]
  59. +
  60. The response will look like this:
  61. +
  62. [source,console-result]
  63. ----
  64. {
  65. "my-repo": { <1>
  66. "type": "s3",
  67. "settings": {
  68. "bucket": "repo-bucket",
  69. "client": "elastic-internal-71bcd3",
  70. "base_path": "myrepo"
  71. }
  72. }
  73. }
  74. ----
  75. // TESTRESPONSE[skip:the result is for illustrating purposes only]
  76. +
  77. <1> Represents the current configuration for the repository.
  78. . Using the settings retrieved above, add the `readonly: true` option to mark
  79. it as read-only:
  80. +
  81. [source,console]
  82. ----
  83. PUT _snapshot/my-repo
  84. {
  85. "type": "s3",
  86. "settings": {
  87. "bucket": "repo-bucket",
  88. "client": "elastic-internal-71bcd3",
  89. "base_path": "myrepo",
  90. "readonly": true <1>
  91. }
  92. }
  93. ----
  94. // TEST[skip:we're not setting up repos in these tests]
  95. +
  96. <1> Marks the repository as read-only.
  97. . Alternatively, deleting the repository is an option using:
  98. +
  99. [source,console]
  100. ----
  101. DELETE _snapshot/my-repo
  102. ----
  103. // TEST[skip:we're not setting up repos in these tests]
  104. +
  105. The response will look like this:
  106. +
  107. [source,console-result]
  108. ------------------------------------------------------------------------------
  109. {
  110. "acknowledged": true
  111. }
  112. ------------------------------------------------------------------------------
  113. // TESTRESPONSE[skip:the result is for illustrating purposes only]
  114. At this point, it's only the primary (current) cluster that has the repository marked
  115. as writeable.
  116. {es} sees it as corrupt though so let's recreate it so that {es} can resume using it.
  117. Note that now we're configuring the primary (current) cluster:
  118. . Get the configuration of the repository and save its configuration as we'll use it
  119. to recreate the repository:
  120. +
  121. [source,console]
  122. ----
  123. GET _snapshot/my-repo
  124. ----
  125. // TEST[skip:we're not setting up repos in these tests]
  126. . Using the configuration we obtained above, let's recreate the repository:
  127. +
  128. [source,console]
  129. ----
  130. PUT _snapshot/my-repo
  131. {
  132. "type": "s3",
  133. "settings": {
  134. "bucket": "repo-bucket",
  135. "client": "elastic-internal-71bcd3",
  136. "base_path": "myrepo"
  137. }
  138. }
  139. ----
  140. // TEST[skip:we're not setting up repos in these tests]
  141. +
  142. The response will look like this:
  143. +
  144. [source,console-result]
  145. ------------------------------------------------------------------------------
  146. {
  147. "acknowledged": true
  148. }
  149. ------------------------------------------------------------------------------
  150. // TESTRESPONSE[skip:the result is for illustrating purposes only]
  151. // end::self-managed[]