repository-azure.asciidoc 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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. :plugin_name: repository-azure
  6. include::install_remove.asciidoc[]
  7. [[repository-azure-usage]]
  8. ==== Azure Repository
  9. To enable Azure repositories, you have first to set your azure storage settings in `elasticsearch.yml` file:
  10. [source,yaml]
  11. ----
  12. cloud:
  13. azure:
  14. storage:
  15. my_account:
  16. account: your_azure_storage_account
  17. key: your_azure_storage_key
  18. ----
  19. Note that you can also define more than one account:
  20. [source,yaml]
  21. ----
  22. cloud:
  23. azure:
  24. storage:
  25. my_account1:
  26. account: your_azure_storage_account1
  27. key: your_azure_storage_key1
  28. default: true
  29. my_account2:
  30. account: your_azure_storage_account2
  31. key: your_azure_storage_key2
  32. ----
  33. `my_account1` is the default account which will be used by a repository unless you set an explicit one.
  34. You can set the client side timeout to use when making any single request. It can be defined globally, per account or both.
  35. It's not set by default which means that elasticsearch is using the
  36. http://azure.github.io/azure-storage-java/com/microsoft/azure/storage/RequestOptions.html#setTimeoutIntervalInMs(java.lang.Integer)[default value]
  37. set by the azure client (known as 5 minutes).
  38. `max_retries` can help to control the exponential backoff policy. It will fix the number of retries
  39. in case of failures before considering the snapshot is failing. Defaults to `3` retries.
  40. The initial backoff period is defined by Azure SDK as `30s`. Which means `30s` of wait time
  41. before retrying after a first timeout or failure. The maximum backoff period is defined by Azure SDK as
  42. `90s`.
  43. [source,yaml]
  44. ----
  45. cloud:
  46. azure:
  47. storage:
  48. timeout: 10s
  49. my_account1:
  50. account: your_azure_storage_account1
  51. key: your_azure_storage_key1
  52. default: true
  53. max_retries: 7
  54. my_account2:
  55. account: your_azure_storage_account2
  56. key: your_azure_storage_key2
  57. timeout: 30s
  58. ----
  59. In this example, timeout will be `10s` per try for `my_account1` with `7` retries before failing
  60. and `30s` per try for `my_account2` with `3` retries.
  61. [IMPORTANT]
  62. .Supported Azure Storage Account types
  63. ===============================================
  64. The Azure Repository plugin works with all Standard storage accounts
  65. * Standard Locally Redundant Storage - `Standard_LRS`
  66. * Standard Zone-Redundant Storage - `Standard_ZRS`
  67. * Standard Geo-Redundant Storage - `Standard_GRS`
  68. * Standard Read Access Geo-Redundant Storage - `Standard_RAGRS`
  69. https://azure.microsoft.com/en-gb/documentation/articles/storage-premium-storage[Premium Locally Redundant Storage] (`Premium_LRS`) is **not supported** as it is only usable as VM disk storage, not as general storage.
  70. ===============================================
  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. You must create the azure container before creating the repository.
  79. Defaults to `elasticsearch-snapshots`.
  80. `base_path`::
  81. Specifies the path within container to repository data. Defaults to empty
  82. (root directory).
  83. `chunk_size`::
  84. Big files can be broken down into chunks during snapshotting if needed.
  85. The chunk size can be specified in bytes or by using size value notation,
  86. i.e. `1g`, `10m`, `5k`. Defaults to `64m` (64m max)
  87. `compress`::
  88. When set to `true` metadata files are stored in compressed format. This
  89. setting doesn't affect index files that are already compressed by default.
  90. Defaults to `false`.
  91. `readonly`::
  92. Makes repository read-only. Defaults to `false`.
  93. `location_mode`::
  94. `primary_only` or `secondary_only`. Defaults to `primary_only`. Note that if you set it
  95. to `secondary_only`, it will force `readonly` to true.
  96. Some examples, using scripts:
  97. [source,js]
  98. ----
  99. # The simpliest one
  100. PUT _snapshot/my_backup1
  101. {
  102. "type": "azure"
  103. }
  104. # With some settings
  105. PUT _snapshot/my_backup2
  106. {
  107. "type": "azure",
  108. "settings": {
  109. "container": "backup-container",
  110. "base_path": "backups",
  111. "chunk_size": "32m",
  112. "compress": true
  113. }
  114. }
  115. # With two accounts defined in elasticsearch.yml (my_account1 and my_account2)
  116. PUT _snapshot/my_backup3
  117. {
  118. "type": "azure",
  119. "settings": {
  120. "account": "my_account1"
  121. }
  122. }
  123. PUT _snapshot/my_backup4
  124. {
  125. "type": "azure",
  126. "settings": {
  127. "account": "my_account2",
  128. "location_mode": "primary_only"
  129. }
  130. }
  131. ----
  132. // CONSOLE
  133. // TEST[skip:we don't have azure setup while testing this]
  134. Example using Java:
  135. [source,java]
  136. ----
  137. client.admin().cluster().preparePutRepository("my_backup_java1")
  138. .setType("azure").setSettings(Settings.builder()
  139. .put(Storage.CONTAINER, "backup-container")
  140. .put(Storage.CHUNK_SIZE, new ByteSizeValue(32, ByteSizeUnit.MB))
  141. ).get();
  142. ----
  143. [[repository-azure-validation]]
  144. ===== Repository validation rules
  145. According to the http://msdn.microsoft.com/en-us/library/dd135715.aspx[containers naming guide], a container name must
  146. be a valid DNS name, conforming to the following naming rules:
  147. * Container names must start with a letter or number, and can contain only letters, numbers, and the dash (-) character.
  148. * Every dash (-) character must be immediately preceded and followed by a letter or number; consecutive dashes are not
  149. permitted in container names.
  150. * All letters in a container name must be lowercase.
  151. * Container names must be from 3 through 63 characters long.