repository-azure.asciidoc 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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 define your azure storage settings as
  10. {ref}/secure-settings.html[secure settings], before starting up the node:
  11. [source,sh]
  12. ----------------------------------------------------------------
  13. bin/elasticsearch-keystore add azure.client.default.account
  14. bin/elasticsearch-keystore add azure.client.default.key
  15. ----------------------------------------------------------------
  16. Where `account` is the azure account name and `key` the azure secret key. Instead of an azure secret key under `key`, you can alternatively
  17. define a shared access signatures (SAS) token under `sas_token` to use for authentication instead. When using an SAS token instead of an
  18. account key, the SAS token must have read (r), write (w), list (l), and delete (d) permissions for the repository base path and
  19. all its contents. These permissions need to be granted for the blob service (b) and apply to resource types service (s), container (c), and
  20. object (o).
  21. These settings are used by the repository's internal azure client.
  22. Note that you can also define more than one account:
  23. [source,sh]
  24. ----------------------------------------------------------------
  25. bin/elasticsearch-keystore add azure.client.default.account
  26. bin/elasticsearch-keystore add azure.client.default.key
  27. bin/elasticsearch-keystore add azure.client.secondary.account
  28. bin/elasticsearch-keystore add azure.client.secondary.sas_token
  29. ----------------------------------------------------------------
  30. `default` is the default account name which will be used by a repository,
  31. unless you set an explicit one in the
  32. <<repository-azure-repository-settings, repository settings>>.
  33. The `account`, `key`, and `sas_token` storage settings are
  34. {ref}/secure-settings.html#reloadable-secure-settings[reloadable]. After you
  35. reload the settings, the internal azure clients, which are used to transfer the
  36. snapshot, will utilize the latest settings from the keystore.
  37. NOTE: In progress snapshot/restore jobs will not be preempted by a *reload*
  38. of the storage secure settings. They will complete using the client as it was built
  39. when the operation started.
  40. You can set the client side timeout to use when making any single request. It can be defined globally, per account or both.
  41. It's not set by default which means that Elasticsearch is using the
  42. http://azure.github.io/azure-storage-java/com/microsoft/azure/storage/RequestOptions.html#setTimeoutIntervalInMs(java.lang.Integer)[default value]
  43. set by the azure client (known as 5 minutes).
  44. `max_retries` can help to control the exponential backoff policy. It will fix the number of retries
  45. in case of failures before considering the snapshot is failing. Defaults to `3` retries.
  46. The initial backoff period is defined by Azure SDK as `30s`. Which means `30s` of wait time
  47. before retrying after a first timeout or failure. The maximum backoff period is defined by Azure SDK as
  48. `90s`.
  49. `endpoint_suffix` can be used to specify Azure endpoint suffix explicitly. Defaults to `core.windows.net`.
  50. [source,yaml]
  51. ----
  52. azure.client.default.timeout: 10s
  53. azure.client.default.max_retries: 7
  54. azure.client.default.endpoint_suffix: core.chinacloudapi.cn
  55. azure.client.secondary.timeout: 30s
  56. ----
  57. In this example, timeout will be `10s` per try for `default` with `7` retries before failing
  58. and endpoint suffix will be `core.chinacloudapi.cn` and `30s` per try for `secondary` with `3` retries.
  59. [IMPORTANT]
  60. .Supported Azure Storage Account types
  61. ===============================================
  62. The Azure Repository plugin works with all Standard storage accounts
  63. * Standard Locally Redundant Storage - `Standard_LRS`
  64. * Standard Zone-Redundant Storage - `Standard_ZRS`
  65. * Standard Geo-Redundant Storage - `Standard_GRS`
  66. * Standard Read Access Geo-Redundant Storage - `Standard_RAGRS`
  67. 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.
  68. ===============================================
  69. You can register a proxy per client using the following settings:
  70. [source,yaml]
  71. ----
  72. azure.client.default.proxy.host: proxy.host
  73. azure.client.default.proxy.port: 8888
  74. azure.client.default.proxy.type: http
  75. ----
  76. Supported values for `proxy.type` are `direct` (default), `http` or `socks`.
  77. When `proxy.type` is set to `http` or `socks`, `proxy.host` and `proxy.port` must be provided.
  78. [[repository-azure-repository-settings]]
  79. ==== Repository settings
  80. The Azure repository supports following settings:
  81. `client`::
  82. Azure named client to use. Defaults to `default`.
  83. `container`::
  84. Container name. You must create the azure container before creating the repository.
  85. Defaults to `elasticsearch-snapshots`.
  86. `base_path`::
  87. Specifies the path within container to repository data. Defaults to empty
  88. (root directory).
  89. `chunk_size`::
  90. Big files can be broken down into chunks during snapshotting if needed.
  91. The chunk size can be specified in bytes or by using size value notation,
  92. i.e. `1g`, `10m`, `5k`. Defaults to `64m` (64m max)
  93. `compress`::
  94. When set to `true` metadata files are stored in compressed format. This
  95. setting doesn't affect index files that are already compressed by default.
  96. Defaults to `true`.
  97. include::repository-shared-settings.asciidoc[]
  98. `location_mode`::
  99. `primary_only` or `secondary_only`. Defaults to `primary_only`. Note that if you set it
  100. to `secondary_only`, it will force `readonly` to true.
  101. Some examples, using scripts:
  102. [source,js]
  103. ----
  104. # The simplest one
  105. PUT _snapshot/my_backup1
  106. {
  107. "type": "azure"
  108. }
  109. # With some settings
  110. PUT _snapshot/my_backup2
  111. {
  112. "type": "azure",
  113. "settings": {
  114. "container": "backup-container",
  115. "base_path": "backups",
  116. "chunk_size": "32m",
  117. "compress": true
  118. }
  119. }
  120. # With two accounts defined in elasticsearch.yml (my_account1 and my_account2)
  121. PUT _snapshot/my_backup3
  122. {
  123. "type": "azure",
  124. "settings": {
  125. "client": "secondary"
  126. }
  127. }
  128. PUT _snapshot/my_backup4
  129. {
  130. "type": "azure",
  131. "settings": {
  132. "client": "secondary",
  133. "location_mode": "primary_only"
  134. }
  135. }
  136. ----
  137. // CONSOLE
  138. // TEST[skip:we don't have azure setup while testing this]
  139. Example using Java:
  140. [source,java]
  141. ----
  142. client.admin().cluster().preparePutRepository("my_backup_java1")
  143. .setType("azure").setSettings(Settings.builder()
  144. .put(Storage.CONTAINER, "backup-container")
  145. .put(Storage.CHUNK_SIZE, new ByteSizeValue(32, ByteSizeUnit.MB))
  146. ).get();
  147. ----
  148. [[repository-azure-validation]]
  149. ==== Repository validation rules
  150. According to the http://msdn.microsoft.com/en-us/library/dd135715.aspx[containers naming guide], a container name must
  151. be a valid DNS name, conforming to the following naming rules:
  152. * Container names must start with a letter or number, and can contain only letters, numbers, and the dash (-) character.
  153. * Every dash (-) character must be immediately preceded and followed by a letter or number; consecutive dashes are not
  154. permitted in container names.
  155. * All letters in a container name must be lowercase.
  156. * Container names must be from 3 through 63 characters long.