repository-azure.asciidoc 6.9 KB

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