repository-azure.asciidoc 5.9 KB

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