repository-azure.asciidoc 6.3 KB

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