repository-azure.asciidoc 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. [[repository-azure]]
  2. === Azure Repository Plugin
  3. The Azure Repository plugin adds support for using Azure as a repository for
  4. {ref}/modules-snapshots.html[Snapshot/Restore].
  5. [[repository-azure-install]]
  6. [float]
  7. ==== Installation
  8. This plugin can be installed using the plugin manager:
  9. [source,sh]
  10. ----------------------------------------------------------------
  11. sudo bin/elasticsearch-plugin install repository-azure
  12. ----------------------------------------------------------------
  13. The plugin must be installed on every node in the cluster, and each node must
  14. be restarted after installation.
  15. [[repository-azure-remove]]
  16. [float]
  17. ==== Removal
  18. The plugin can be removed with the following command:
  19. [source,sh]
  20. ----------------------------------------------------------------
  21. sudo bin/elasticsearch-plugin remove repository-azure
  22. ----------------------------------------------------------------
  23. The node must be stopped before removing the plugin.
  24. [[repository-azure-usage]]
  25. ==== Azure Repository
  26. To enable Azure repositories, you have first to set your azure storage settings in `elasticsearch.yml` file:
  27. [source,yaml]
  28. ----
  29. cloud:
  30. azure:
  31. storage:
  32. my_account:
  33. account: your_azure_storage_account
  34. key: your_azure_storage_key
  35. ----
  36. Note that you can also define more than one account:
  37. [source,yaml]
  38. ----
  39. cloud:
  40. azure:
  41. storage:
  42. my_account1:
  43. account: your_azure_storage_account1
  44. key: your_azure_storage_key1
  45. default: true
  46. my_account2:
  47. account: your_azure_storage_account2
  48. key: your_azure_storage_key2
  49. ----
  50. `my_account1` is the default account which will be used by a repository unless you set an explicit one.
  51. You can set the client side timeout to use when making any single request. It can be defined globally, per account or both.
  52. It's not set by default which means that elasticsearch is using the
  53. http://azure.github.io/azure-storage-java/com/microsoft/azure/storage/RequestOptions.html#setTimeoutIntervalInMs(java.lang.Integer)[default value]
  54. set by the azure client (known as 5 minutes).
  55. [source,yaml]
  56. ----
  57. cloud:
  58. azure:
  59. storage:
  60. timeout: 10s
  61. my_account1:
  62. account: your_azure_storage_account1
  63. key: your_azure_storage_key1
  64. default: true
  65. my_account2:
  66. account: your_azure_storage_account2
  67. key: your_azure_storage_key2
  68. timeout: 30s
  69. ----
  70. In this example, timeout will be 10s for `my_account1` and 30s for `my_account2`.
  71. [[repository-azure-repository-settings]]
  72. ===== Repository settings
  73. The Azure repository supports following settings:
  74. `account`::
  75. Azure account settings to use. Defaults to the only one if you set a single
  76. account or to the one marked as `default` if you have more than one.
  77. `container`::
  78. Container name. Defaults to `elasticsearch-snapshots`
  79. `base_path`::
  80. Specifies the path within container to repository data. Defaults to empty
  81. (root directory).
  82. `chunk_size`::
  83. Big files can be broken down into chunks during snapshotting if needed.
  84. The chunk size can be specified in bytes or by using size value notation,
  85. i.e. `1g`, `10m`, `5k`. Defaults to `64m` (64m max)
  86. `compress`::
  87. When set to `true` metadata files are stored in compressed format. This
  88. setting doesn't affect index files that are already compressed by default.
  89. Defaults to `false`.
  90. `read_only`::
  91. Makes repository read-only. coming[2.1.0] Defaults to `false`.
  92. `location_mode`::
  93. `primary_only` or `secondary_only`. Defaults to `primary_only`. Note that if you set it
  94. to `secondary_only`, it will force `read_only` to true.
  95. Some examples, using scripts:
  96. [source,js]
  97. ----
  98. # The simpliest one
  99. PUT _snapshot/my_backup1
  100. {
  101. "type": "azure"
  102. }
  103. # With some settings
  104. PUT _snapshot/my_backup2
  105. {
  106. "type": "azure",
  107. "settings": {
  108. "container": "backup-container",
  109. "base_path": "backups",
  110. "chunk_size": "32m",
  111. "compress": true
  112. }
  113. }
  114. # With two accounts defined in elasticsearch.yml (my_account1 and my_account2)
  115. PUT _snapshot/my_backup3
  116. {
  117. "type": "azure",
  118. "settings": {
  119. "account": "my_account1"
  120. }
  121. }
  122. PUT _snapshot/my_backup4
  123. {
  124. "type": "azure",
  125. "settings": {
  126. "account": "my_account2",
  127. "location_mode": "primary_only"
  128. }
  129. }
  130. ----
  131. // CONSOLE
  132. // TEST[skip:we don't have azure setup while testing this]
  133. Example using Java:
  134. [source,java]
  135. ----
  136. client.admin().cluster().preparePutRepository("my_backup_java1")
  137. .setType("azure").setSettings(Settings.settingsBuilder()
  138. .put(Storage.CONTAINER, "backup-container")
  139. .put(Storage.CHUNK_SIZE, new ByteSizeValue(32, ByteSizeUnit.MB))
  140. ).get();
  141. ----
  142. [[repository-azure-global-settings]]
  143. ===== Global repositories settings
  144. All those repository settings can also be defined globally in `elasticsearch.yml` file using prefix
  145. `repositories.azure.`. For example:
  146. [source,yaml]
  147. ----
  148. repositories.azure:
  149. container: backup-container
  150. base_path: backups
  151. chunk_size: 32m
  152. compress": true
  153. ----
  154. [[repository-azure-validation]]
  155. ===== Repository validation rules
  156. According to the http://msdn.microsoft.com/en-us/library/dd135715.aspx[containers naming guide], a container name must
  157. be a valid DNS name, conforming to the following naming rules:
  158. * Container names must start with a letter or number, and can contain only letters, numbers, and the dash (-) character.
  159. * Every dash (-) character must be immediately preceded and followed by a letter or number; consecutive dashes are not
  160. permitted in container names.
  161. * All letters in a container name must be lowercase.
  162. * Container names must be from 3 through 63 characters long.